From 6b939d40f6a29a43277566adc9d4312d49cb3abf Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Thu, 6 May 2010 19:54:49 +0200 Subject: Add -rpath option for host package compilation In c1b6242fdcf2cff7ebf09fec4cc1be58963e8427, we added $(HOST_DIR)/usr/lib to LD_LIBRARY_PATH when building target packages, because the build of target packages sometimes require host tools installed in $(HOST_DIR)/usr/bin which themselves require host libaries installed in $(HOST_DIR)/usr/lib. Unfortunately, this solution didn't work, as libtool then tried to link target binaries against host libraries. So $(HOST_DIR)/usr/lib got removed from LD_LIBRARY_PATH in 0d1830b07db4ebfd14e77a258de6fb391e57e960. However, this meant that we went back to the previous situation, in which host tools used during compilation of target components might require host libraries. An example : make[2]: Entering directory `/home/test/buildroot/output.ctng-arm-eglibc-2010-05-04-12-41-00/build/xfont_font-adobe-100dpi-1.0.1' /home/test/buildroot/output.ctng-arm-eglibc-2010-05-04-12-41-00/host/usr/bin/mkfontdir /home/test/buildroot/output.ctng-arm-eglibc-2010-05-04-12-41-00/target/usr/share/fonts/X11/100dpi /home/test/buildroot/output.ctng-arm-eglibc-2010-05-04-12-41-00/host/usr/bin/mkfontscale: error while loading shared libraries: libfontenc.so.1: cannot open shared object file: No such file or directory Therefore, we try another solution: make sure that host binaries are linked with an -rpath option, so that $(HOST_DIR)/usr/lib doesn't need to be in LD_LIBRARY_PATH for them to find their libraries. Signed-off-by: Thomas Petazzoni --- package/Makefile.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/Makefile.in b/package/Makefile.in index eab916870..0bec9a1c2 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -77,6 +77,11 @@ ifeq ($(BR2_LARGEFILE),y) TARGET_CFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 endif +# Host packages are sometimes linked against host libraries installed +# in $(HOST_DIR)/usr/lib. As we cannot add $(HOST_DIR)/usr/lib to +# LD_LIBRARY_PATH when building target packages because it causes +# libtool breakage, we force a rpath to be added to host binaries. +HOST_CFLAGS+=-Wl,-rpath -Wl,$(HOST_DIR)/usr/lib ######################################################################### ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) -- cgit v1.2.3