[Buildroot] [PATCH 3/3] package/libarchive: fix linking issue with uClibc
Thomas Petazzoni
thomas.petazzoni at free-electrons.com
Mon Aug 25 21:03:56 UTC 2014
Dear Romain Naour,
On Sun, 24 Aug 2014 18:53:06 +0200, Romain Naour wrote:
> With uClibc the dynamic linking loader functions needs
> to be linked with -ldl
>
> Fixes:
> http://autobuild.buildroot.net/results/6af/6af140618b274536238b062635d493709905c8f6/build-end.log
>
> Signed-off-by: Romain Naour <romain.naour at openwide.fr>
> ---
> package/libarchive/libarchive.mk | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/package/libarchive/libarchive.mk b/package/libarchive/libarchive.mk
> index 8c6951d..ce3355c 100644
> --- a/package/libarchive/libarchive.mk
> +++ b/package/libarchive/libarchive.mk
> @@ -68,4 +68,8 @@ else
> LIBARCHIVE_CONF_OPT += --without-zlib
> endif
>
> +ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
> +LIBARCHIVE_CONF_ENV += LIBS="-ldl"
> +endif
> +
> $(eval $(autotools-package))
I don't think this is the right fix, for several reasons:
*) The problem only occurs due to the fact that bsdcpio and bsdtar are
by default linked statically. When BR2_PREFER_STATIC_LIB is
disabled, we should pass --enable-bsdtar=shared and
--enable-bsdcpio=shared to ensure they are dynamically linked. This
fixes the problem in the dynamic linking case.
*) The problem is caused by the dependency of OpenSSL on libdl. So
there is no need to always link against libdl: it should only be
done when BR2_PREFER_STATIC_LIB=y and OpenSSL is enabled.
*) I don't see why the problem would be uClibc specific.
Generally speaking, it's annoying to have to teach all packages
using OpenSSL that they should link against -ldl when doing static
linking. It would be so much better if everyone was using pkg-config...
Best regards,
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
More information about the buildroot
mailing list