Source: gcc-4.2
Version: 4.2.2-7
Severity: normal
Tags: patch
I am trying to build a cross compiler targeting amd64, using the method
described at <http://www.emdebian.org/tools/crossdev.html>:
* Build and install cross-binutils
* Convert and install libc etc. with dpkg-cross
[ NB: libc6-i386, libc6-dev-i386 and lib32gcc1 may need manual
conversion - see Bug #463588 ]
* gcc:
$ export GCC_TARGET=amd64
$ cd gcc-4.2-4.2.2
$ debian/rules control
$ dpkg-buildpackage -b -rfakeroot
Below is the tail of the output from the last step. This turns out to be
just the first of several errors in debian/rules.d/binary-libstdcxx-cross.mk:
* The commands for make target $(binary-stamp)-lib32stdcxx use variables
$(dirs_lib32) and $(files_lib32), which are not defined anywhere.
Fixed by adding definitions analogous to those for _lib and _lib64.
* In the same rule, the commands to move libraries to the debug package
directory say usr/$(DEB_TARGET_GNU_TYPE)/lib/debug where they should
be using .../lib32/... .
* In the same rule, dh_makeshlibs is not invoked, causing subsequent
shlibs manipulation to fail.
* In the lib, lib64 and lib32 rules, dh_shlibdeps either fails or finds
the wrong libraries, because it searches the build host's libraries
and not the cross lib dir. "Fixed" with -l option, but may still
misbehave if the required cross libs are not installed - arguably a
deficiency of dpkg-shlibdeps.
* The lib32 and lib64 rules run dh_gencontrol for the corresponding
debug package, but not dh_installdeb. This makes dpkg-genchanges fail
when it cannot find a deb listed in debian/files.
* lib32stdc++ is built but is left out of the generated control file.
I attach a patch for all of the above.
dh_testdir
dh_testroot
mv stamps/07-install-stamp stamps/07-install-stamp-tmp
rm -rf debian/lib32stdc++6-amd64-cross
dh_installdirs -plib32stdc++6-amd64-cross
DH_COMPAT=2 dh_movefiles -plib32stdc++6-amd64-cross
dh_movefiles: Compatibility levels before 4 are deprecated.
dh_installdirs -plib32stdc++6-4.2-dbg-amd64-cross \
usr/x86_64-linux-gnu/lib32
mv debian/tmp/usr/x86_64-linux-gnu/lib32/debug
debian/lib32stdc++6-4.2-dbg-amd64-cross/usr/x86_64-linux-gnu/lib32/.
mkdir -p debian/lib32stdc++6-4.2-dbg-amd64-cross
PATH=/usr/share/dpkg-cross:$PATH dh_strip -plib32stdc++6-amd64-cross
--keep-debug
# The above line puts debugging information into some strange location
# that is hardcoded into dh_strip. Move it from there.
mkdir -p debian/lib32stdc++6-amd64-cross/usr/x86_64-linux-gnu/lib32/debug
mv debian/lib32stdc++6-amd64-cross/usr/lib/debug/usr/x86_64-linux-gnu/lib32/*
debian/lib32stdc++6-amd64-cross/usr/x86_64-linux-gnu/lib32/debug/
mv: cannot stat
`debian/lib32stdc++6-amd64-cross/usr/lib/debug/usr/x86_64-linux-gnu/lib32/*':
No such file or directory
make[1]: *** [stamps/08-binary-stamp-lib32stdcxx] Error 1
make[1]: Leaving directory `/mnt/spare/timb/gcc-4.2-4.2.2'
make: *** [binary] Error 2
dpkg-buildpackage: failure: fakeroot debian/rules binary gave error exit status
2
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-1-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages gcc-4.2 depends on:
ii binutils 2.18.1~cvs20080103-1 The GNU assembler, linker and bina
ii cpp-4.2 4.2.2-7 The GNU C preprocessor
ii gcc-4.2-base 4.2.2-7 The GNU Compiler Collection (base
ii libc6 2.7-6 GNU C Library: Shared libraries
ii libgcc1 1:4.3-20080127-1 GCC support library
Versions of packages gcc-4.2 recommends:
ii libc6-dev 2.7-6 GNU C Library: Development Librari
-- no debconf information
--- 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,7 @@
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)
+ ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib) -l/usr/$(DEB_TARGET_GNU_TYPE)/lib
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 +181,11 @@
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)
+ ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib64) -l/usr/$(DEB_TARGET_GNU_TYPE)/lib64
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 +217,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 +229,14 @@
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)
+ ARCH=$(DEB_TARGET_ARCH) MAKEFLAGS="CC=something" dh_shlibdeps -p$(p_lib32) -l/usr/$(DEB_TARGET_GNU_TYPE)/lib32
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