[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: binutils 2.15 without default search path /usr/arch-linux/lib (+patch)



Hi all again,

I'm now sure it's a binutils problem with the search path for
libraries. Here my analysis of the problem and a patch against
binutils-cross-2.15-5.patch.20041130 (see Debian bug #231707).

The ld/ldmain.c:670 function set_scripts_dir() try to identify
the location of libraryies. The directory name will be determined
using the make_relative_prefix() function which create a relative
path using three informations:
 1. The path of the arch-linux-ld application (searching PATH)
 2. The BINDIR (configure option --prefix=/usr + /bin by default)
 3. The SCRIPTDIR (configure option --libdir by default {prefix}/lib)

Today folowing values are set:
 1. = /usr/bin/arch-linux-ld
 2. = /usr/bin
 3. = /usr/lib

The make_relative_prefix() function create now a relative path
between (2) and (3). This is "../lib" and applies this to the
dir's part of (1): "/usr/../lib" This directory will be now used
to determine the location of *cross* libraries.

This directory is not valid for cross-environments where libraries
are within the /usr/arch-linux/lib directory. A solution is to
set the configure --libdir=/usr/$(TARGET)/lib options. This is the
case for the patch applied to this email.

--
Raphael Bossek
diff -Nru binutils/debian/rules binutils-2.15/debian/rules
--- binutils/debian/rules	2005-04-27 14:04:53.629792488 +0200
+++ binutils-2.15/debian/rules	2005-04-27 14:04:03.794368624 +0200
@@ -471,7 +471,7 @@
 	cd builddir-$(TARGET) \
 	    && env CC="$(CC)" ../configure --host=$(DEB_HOST_GNU_TYPE) \
 	        --build=$(DEB_BUILD_GNU_TYPE) --target=$(TARGET) --prefix=/usr \
-		$(ADDITIONAL_TARGETS)
+	        --libdir=/usr/$(TARGET)/lib $(ADDITIONAL_TARGETS)
 	touch $@
 
 build-$(TARGET)-stamp: configure-$(TARGET)-stamp
@@ -485,6 +485,7 @@
 	test "" != "$(TARGET)"
 	rm -rf $(d_cross)
 	$(MAKE) -C builddir-$(TARGET) prefix=$(pwd)/$(d_cross)/usr \
+		libdir=$(pwd)/$(d_cross)/usr/$(TARGET)/lib \
 		mandir=$(pwd)/$(d_cross)/usr/share/man install
 	rm -rf $(d_cross)/usr/lib $(d_cross)/usr/info $(d_cross)/usr/share/locale
 	$(STRIP) $(d_cross)/usr/bin/*

Reply to: