On Wed, 5 Dec 2007 00:01:22 +0100 Raphael Hertzog <[EMAIL PROTECTED]> wrote:
> On Tue, 04 Dec 2007, Neil Williams wrote: > > +my @shlibdeps=(); > > +# ARCH for some awkward builds > > +my $crossprefix = Dpkg::Arch::debarch_to_gnutriplet($ENV{ARCH}) if > > ($ENV{ARCH}); > > What's the role of $ARCH ? And why shall we consider that we're > crossbuilding only because this variable is set ? Not cross building - building a cross compiler. gcc relies on $ARCH when preparing libgcc1-$arch-cross and other toolchain libraries. The actual call in gcc is: ARCH=arm MAKEFLAGS="CC=something" dh_shlibdeps -plibgcc1-arm-cross e.g. > cd /opt/emdebian/emchain/gcc-4.2-4.2.2 > GCC_TARGET=arm DEB_CROSS=yes debian/rules control > GCC_TARGET=arm DEB_CROSS=yes dpkg-buildpackage -b -uc -us -rfakeroot > > build completes as normal with the patch > > Testing from gcc-4.2-4.2.2 directory: > ARCH=arm MAKEFLAGS="CC=something" dh_shlibdeps -plibgcc1-arm-cross > > no errors. > > Without the patch, I get: > dpkg-shlibdeps: failure: couldn't find library libc.so.6 needed by > debian/libgcc1-arm-cross/usr/arm-linux-gnu/lib/libgcc_s.so.1 (its RPATH > is ''). > Note: libraries are not searched in other binary packages that do not > have any shlibs file. > To help dpkg-shlibdeps find private libraries, you might need to set > LD_LIBRARY_PATH. > dh_shlibdeps: command returned error code 512 ... > > +# host for normal cross builds. > > +$crossprefix = $ENV{DEB_HOST_GNU_TYPE} > > + if (($ENV{DEB_HOST_GNU_TYPE}) and ($ENV{DEB_HOST_GNU_TYPE} ne > > $ENV{DEB_BUILD_GNU_TYPE})); > > I think you should use the functions contained in Dpkg::Arch instead of > relying only the environment variables here... Those variables are only defined in a cross build, not when building a cross compiler or a toolchain. We cannot use 'dpkg-architecture -a..' when building a cross compiler, therefore we only have the environment variables. > use Dpkg::Arch qw(get_host_arch get_build_arch debarch_to_gnutriplet); > [...] > if (get_host_arch() ne get_build_arch()) { > $crossprefix = debarch_to_gnutriplet(get_host_arch()); > } > > > +# target when building a cross compiler > > +$crossprefix = $ENV{DEB_TARGET_GNU_TYPE} > > + if (($ENV{DEB_TARGET_GNU_TYPE}) and ($ENV{DEB_TARGET_GNU_TYPE} ne > > $ENV{DEB_BUILD_GNU_TYPE})); > > Why would we need a special treatment of libs when creating a > cross-compiler? The cross-compiler runs on the build arch but is not linked > against any lib of the target arch so it doesn't need to scan the > directories of the target arch. The cross compiler needs to build cross libraries that *are* called when preparing the cross compiler itself. -- Neil Williams ============= http://www.data-freedom.org/ http://www.nosoftwarepatents.com/ http://www.linux.codehelp.co.uk/
pgp6NZvDnv5Nk.pgp
Description: PGP signature