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

Bug#464365: gcc-4.2: patch doesn't solve the problem



> ARCH=arm MAKEFLAGS="CC=something" dh_shlibdeps -plibstdc++6-arm-cross -l/usr/arm-linux-gnu/lib
> /usr/bin/perl: error while loading shared libraries: /usr/arm-linux-gnu/lib/libdl.so.2: ELF file OS ABI invalid

That looks like an error running dpkg-shlibdeps itself. It appears that
where dh_shlibdeps's man page says -l adds directories to
LD_LIBRARY_PATH before running dpkg-shlibdeps, it means that literally -
dpkg-shlibdeps does not allow the directories to be specified (directly)
by a command-line option. I guess building for x86_64 on i386 let me get
away with it.

As pointed out in bug #453267 (see discussion starting at around
<http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453267#41>),
dpkg-shlibdeps is fundamentally broken here: the libraries I want it to
search are not necessarily the same libraries I want to use to run it. I
suppose we just have to wait until that's fixed. I do wonder why the
diversions were removed from dkpg-cross before the equivalent
functionality was properly implemented in dpkg-dev and debhelper.

Hmmm... a possible workaround: Create a fake package build directory
that just contains a symlink to /usr/$(DEB_TARGET_GNU_TYPE)/lib (or
lib32 or lib64, as appropriate), and pass that to dh_shlibdeps with -L.
It's an ugly hack, but does allow dpkg-shlibdeps to find the right
libraries without having to modify LD_LIBRARY_PATH. Updated patch
attached. (If you're wondering about the use of readlink, it's because
although dpkg-shlibdeps does do symlink resolution (which is how this
can work), it's only on the last path component and not recursive, and
one of the libX directories for biarch targets will already be a
symlink.) This patch needs a bit of tidying, as it won't clean properly.

-- 
Tim Bagot, BlueArc Engineering
--- debian/rules.d/binary-libstdcxx-cross.mk
+++ debian/rules.d/binary-libstdcxx-cross.mk
@@ -40,12 +40,19 @@
 	$(docdir) \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib64
 
+dirs_lib32 = \
+	$(docdir) \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib32
+
 files_lib = \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib/libstdc++.so.*
 
 files_lib64 = \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib64/libstdc++.so.*
 
+files_lib32 = \
+	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib32/libstdc++.so.*
+
 dirs_dev = \
 	$(docdir) \
 	$(PF)/$(DEB_TARGET_GNU_TYPE)/lib \
@@ -124,7 +131,9 @@
 	dh_makeshlibs -p$(p_lib) -V '$(p_lib) (>= $(DEB_STDCXX_SOVERSION))' -n
 	sed s/$(cross_lib_arch)//g < debian/$(p_lib)/DEBIAN/shlibs > debian/$(p_lib)/DEBIAN/shlibs.fixed
 	mv debian/$(p_lib)/DEBIAN/shlibs.fixed debian/$(p_lib)/DEBIAN/shlibs
-	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib)
+	mkdir debian/$(p_lib)-deps
+	ln -s "`readlink -e /usr/$(DEB_TARGET_GNU_TYPE)/lib`" debian/$(p_lib)-deps/lib
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib) -L$(p_lib)-deps
 	sed 's/\(lib[^ ]*\) /\1$(cross_lib_arch) /g' < debian/$(p_lib).substvars > debian/$(p_lib).substvars.new
 	mv debian/$(p_lib).substvars.new debian/$(p_lib).substvars
 	dh_gencontrol -p$(p_lib) -- -v$(DEB_VERSION) $(common_substvars)
@@ -174,11 +183,13 @@
 	dh_makeshlibs -p$(p_lib64) -V '$(p_lib64) (>= $(DEB_STDCXX_SOVERSION))' -n
 	sed s/$(cross_lib_arch)//g < debian/$(p_lib64)/DEBIAN/shlibs > debian/$(p_lib64)/DEBIAN/shlibs.fixed
 	mv debian/$(p_lib64)/DEBIAN/shlibs.fixed debian/$(p_lib64)/DEBIAN/shlibs
-	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib64)
+	mkdir debian/$(p_lib64)-deps
+	ln -s "`readlink -e /usr/$(DEB_TARGET_GNU_TYPE)/lib64`" debian/$(p_lib64)-deps/lib
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib64) -L$(p_lib64)-deps
 	sed 's/\(lib[^ ]*\) /\1$(cross_lib_arch) /g' < debian/$(p_lib64).substvars > debian/$(p_lib64).substvars.new
 	mv debian/$(p_lib64).substvars.new debian/$(p_lib64).substvars
 	dh_gencontrol -p$(p_lib64) -- -v$(DEB_VERSION) $(common_substvars)
-	dh_gencontrol -p$(p_dbg64) -- -v$(DEB_VERSION) $(common_substvars)
+	#dh_gencontrol -p$(p_dbg64) -- -v$(DEB_VERSION) $(common_substvars)
 
 	dh_installdeb -p$(p_lib64)
 	dh_md5sums -p$(p_lib64)
@@ -210,8 +221,8 @@
 	rm -rf $(d_lib32)/usr/lib32
 	# End workaround
 	find $(d_lib32)
-	tar -C $(d_lib32) -c -f - usr/$(DEB_TARGET_GNU_TYPE)/lib/debug | tar -v -C $(d_dbg32) -x -f -
-	rm -rf $(d_lib32)/usr/$(DEB_TARGET_GNU_TYPE)/lib/debug
+	tar -C $(d_lib32) -c -f - usr/$(DEB_TARGET_GNU_TYPE)/lib32/debug | tar -v -C $(d_dbg32) -x -f -
+	rm -rf $(d_lib32)/usr/$(DEB_TARGET_GNU_TYPE)/lib32/debug
 
 	dh_installdocs -p$(p_lib32)
 	echo "See /$(docdir)/$(p_base) for more information" \
@@ -222,14 +233,16 @@
 	debian/dh_rmemptydirs -p$(p_lib32)
 	dh_compress -p$(p_lib32)
 	dh_fixperms -p$(p_lib32)
-
+	dh_makeshlibs -p$(p_lib32) -V '$(p_lib32) (>= $(DEB_STDCXX_SOVERSION))' -n
 	sed s/$(cross_lib_arch)//g < debian/$(p_lib32)/DEBIAN/shlibs > debian/$(p_lib32)/DEBIAN/shlibs.fixed
 	mv debian/$(p_lib32)/DEBIAN/shlibs.fixed debian/$(p_lib32)/DEBIAN/shlibs
-	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib32)
+	mkdir debian/$(p_lib32)-deps
+	ln -s "`readlink -e /usr/$(DEB_TARGET_GNU_TYPE)/lib32`" debian/$(p_lib32)-deps/lib
+	ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib32) -L$(p_lib32)-deps
 	sed 's/\(lib[^ ]*\) /\1$(cross_lib_arch) /g' < debian/$(p_lib32).substvars > debian/$(p_lib32).substvars.new
 	mv debian/$(p_lib32).substvars.new debian/$(p_lib32).substvars
 	dh_gencontrol -p$(p_lib32) -- -v$(DEB_VERSION) $(common_substvars)
-	dh_gencontrol -p$(p_dbg32) -- -v$(DEB_VERSION) $(common_substvars)
+	#dh_gencontrol -p$(p_dbg32) -- -v$(DEB_VERSION) $(common_substvars)
 
 	dh_installdeb -p$(p_lib32)
 	dh_md5sums -p$(p_lib32)
--- debian/rules.conf
+++ debian/rules.conf
@@ -447,7 +447,7 @@
 
 ifdef DEB_CROSS
   languages = c c++ objc objpp
-  addons = libgcc lib64gcc libcxx lib64cxx cdev c++dev libobjc objcdev objppdev gccxbase
+  addons = libgcc lib64gcc libcxx lib32cxx lib64cxx cdev c++dev libobjc objcdev objppdev gccxbase
   ifeq ($(with_d),yes)
     ifeq ($(with_separate_gdc),yes)
       languages = # disable others languages

Reply to: