https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92336
Bug ID: 92336 Summary: cross compiling gcc fails in gm2 Product: gcc Version: 9.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: modula2 Assignee: unassigned at gcc dot gnu.org Reporter: helmut at subdivi dot de CC: doko at debian dot org Target Milestone: --- Host: !=$(build) Target: ==$(host) Build: x86_64-linux-gnu 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.