The version of gcc packaged for Debian (currently based on 9.2.1) fails to cross build. Cross compiler builds appear to work. This bug is about cross building a native compiler. You can find logs of failed builds at http://crossqa.debian.net/src/gcc-9. They always fail with a configure invocation in gm2 that is given a --target, but no --build nor --host. Thus configure assumes a native build, but a cross CC is passed and configure fails: > cd gm2 ; \ > if echo -DIN_GCC | grep \\-DCROSS_COMPILE; then \ > AR=`echo /usr/lib/gcc-cross/s390x-linux-gnu/9/../../../../s390x-linux-gnu/bin/ar | sed -e "s/^ //"` ; \ > export AR ; \ > RANLIB=`echo /usr/lib/gcc-cross/s390x-linux-gnu/9/../../../../s390x-linux-gnu/bin/ranlib | sed -e "s/^ //"` ; \ > export RANLIB ; \ > /bin/bash -c '../../../src/gcc/gm2/configure --srcdir=../../../src/gcc/gm2 --target=s390x-ibm-linux-gnu --program-suffix= --includedir=`echo /usr/include | sed -e :a -e 's,[^/]*/\.\.\/,,' -e ta`' ; \ > else \ > /bin/bash -c '../../../src/gcc/gm2/configure --srcdir=../../../src/gcc/gm2 --target=s390x-ibm-linux-gnu --program-suffix=' ; \ > fi > configure: loading site script /etc/dpkg-cross/cross-config.s390x > checking for s390x-linux-gnu-ar... /usr/bin/s390x-linux-gnu-ar > checking for flex... flex > checking for gcc... s390x-linux-gnu-gcc-9 > checking whether the C compiler works... yes > checking for C compiler default output file name... a.out > checking for suffix of executables... > checking whether we are cross compiling... configure: error: in `/<<PKGBUILDDIR>>/build/gcc/gm2': > configure: error: cannot run C compiled programs. > If you meant to cross compile, use `--host'. > See `config.log' for more details > make[4]: *** [../../src/gcc/gm2/Make-lang.in:1286: gm2/gm2config.h] Error 1 I suspect that quite simply --host and --build flags are missing here as they are present in most other makefiles. Unfortunately, simply adding --build=$(build_alias) --host=$(host_alias) does not work, because the relevant makefile variables are not initialized in this makefile.
thanks for the bug report - yes indeed this is a bug (an oversight) which I'll examine now and fix.
I've just git pushed a number of bug fixes to gm2/Make-lang.in (on the 9.2.0 branch of gm2). I think the above problem should now be fixed.
I suppose that your changes have migrated to gcc-12 now. The problem persists in exactly the same way. A current build failure can bee seen at: https://crossqa.debian.net/build/gcc-12_12.2.0-9_s390x_20221110151612.log Could you look into this again?
A heads up, I'm currently examining this in relation to another two bugs. PR-108182 (target multilib options) and PR-108119 (disabling plugin which involves changes to gcc/m2/configure.ac).
I get a related problem here. Configuring works, but during build, some of the helper programs (like mc) are compiled using $(CXX), which is already a cross-compiler, and therefor the resulting binaries cannot be executed.