Why is the dpkg-cross diversion of dpkg-buildpackage explicitly overriding the MAKEFLAGS environment variable?
DEBUG: setmakeflags=w -- NM=arm-linux-gnu-nm CC=arm-linux-gnu-gcc GCC=arm-linux-gnu-gcc AR=arm-linux-gnu-ar RANLIB=arm-linux-gnu-ranlib CONFIG_SITE=/etc/dpkg-cross/cross-config.arm AS=arm-linux-gnu-as USRLIBDIR=/usr/arm-linux-gnu/lib LD=arm-linux-gnu-ld CXX=arm-linux-gnu-g ++ ARCH=arm CPP=arm-linux-gnu-cpp RC=windres IMAKECPP=arm-linux-gnu-cpp $(MAKE) then receives those settings on the command line via $ENV {'MAKEFLAGS'} and assigns those values a higher priority than whatever is in the obj-foo/src/util/Makefile which means that CC is not set to CC_FOR_BUILD, it is set to arm-linux-gnu-gcc, hence the failure in libx11-6 where CC_FOR_BUILD should be set to 'gcc' so that a buildtime target can be compiled and run. To reset this, I initially used the 'override' command to $(MAKE) but this is only supported by GNU Make. However, using 'override' did solve the problem and that is how the current libx11-6 package was built for Emdebian. The current behaviour undermines this requirement: # Prepend /usr/share/dpkg-cross/ to PATH to make use of the strip wrapper. # Also append $crossbin, so that cross binaries can be found, but # native stuff still has precedence (if a package wants to compile # with 'gcc' a build tool that will be executed, for example). (dpkg-cross.pl line 485) The setting of MAKEFLAGS means that a package that needs to compile a build tool with 'gcc' that will be executed, the tool actually gets compiled with $archtriplet-gcc instead and then promptly dies. This would also solve cross-build failures in a number of other packages (like fontconfig) where build tools need to be compiled and run within a cross-build. I'm testing with simply not specifying any MAKEFLAGS or removing CC, GCC, CXX, CPP and IMAKECPP from the %std_tools list in dpkg-cross.pl so that MAKEFLAGS does not change CC behaviour, only AS, LD, AR, NM, RANLIB and RC. I'll also implement a --debug mode in the diverted dpkg-buildpackage for future testing, outputting to a file in /tmp/. As part of these changes, I'll also test #430507 "dpkg-cross: [Patch] Check dpkg-architecture before falling back to internal tables" - note the unfortunate coincidence in the bug number (!) and prepare a dpkg-cross 1.99+2.0.0pre1 release that will go into Debian experimental for testing. -- Neil Williams ============= http://www.data-freedom.org/ http://www.nosoftwarepatents.com/ http://www.linux.codehelp.co.uk/
pgpBjl2ZkUr94.pgp
Description: PGP signature