- Package:
- src:gcc-13
- Source:
- src:gcc-13
- Submitter:
- Emanuele Rocca
- Date:
- 2024-04-30 13:57:06 UTC
- Severity:
- normal
Hi, cross-building the native compiler (build_type = cross-build-native) fails due to (1) an issue with m2, and (2) nvptx being confused about the host/target system. The first problem is apparently old and known, as shown by the various logs at https://crossqa.debian.net/src/gcc-13 The nvptx issue perhaps is not. On a x86 machine, I've tried building gcc-13 with: DEB_BUILD_OPTIONS='nolang=m2 nocheck' sbuild --host=arm64 After a while the build failed with: checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... nvptx-unknown-none [...] checking whether we are cross compiling... configure: error: in `/<<PKGBUILDDIR>>/build-nvptx': configure: error: cannot run C compiled programs. My understanding is that both the host and target system type should be aarch64-unknown-linux-gnu instead. With nvptx disabled, ie with the following patch applied, and DEB_BUILD_OPTIONS='nolang=m2', gcc-13 cross-builds successfully. --- /tmp/gcc-13-13.2.0/debian/rules.defs 2023-12-14 19:55:12.000000000 +0100 +++ debian/rules.defs 2024-01-05 17:26:13.528700625 +0100 @@ -781,7 +781,7 @@ offload_targets := with_offload_nvptx := endif -ifneq (,$(findstring build-cross, $(build_type))) +ifneq ($(build_type),build-native) offload_targets := with_offload_nvptx := disabled for cross builds endif
> My understanding is that both the host and target system type > should be aarch64-unknown-linux-gnu instead. no, the target is always nvptx-unknown-none. and the package should be part of a cross build, you want to have the same set of packages.
> My understanding is that both the host and target system type > should be aarch64-unknown-linux-gnu instead. no, the target is always nvptx-unknown-none. and the package should be part of a cross build, you want to have the same set of packages.
Control: retitle -1 gcc-13 FTCBFS: nvptx does not cross compile host? I tried cross building gcc 13.2.0-23 on a x86 system with: DEB_BUILD_OPTIONS='nolang=m2' sbuild --host=arm64 And I got the following error in build-nvptx/config.log: configure:4591: checking whether we are cross compiling configure:4599: aarch64-linux-gnu-gcc-13 -o conftest conftest.c >&5 configure:4603: $? = 0 configure:4610: ./conftest ../src-nvptx/configure: line 4612: ./conftest: cannot execute binary file: Exec format error Things looked slightly better adding --build and --host to CONFARGS_NVPTX, at least the build process went past the "checking whether we are cross compiling" step. diff -Nru gcc-13-13.2.0/debian/rules2 gcc-13-13.2.0/debian/rules2 --- gcc-13-13.2.0/debian/rules2 2024-03-23 13:29:34.000000000 +0100 +++ gcc-13-13.2.0/debian/rules2 2024-04-30 10:28:00.000000000 +0200 @@ -1524,7 +1524,9 @@ --enable-languages=c,c++,fortran,lto \ --enable-checking=release \ --with-system-zlib \ - --without-isl + --without-isl \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --host=$(DEB_HOST_GNU_TYPE) # --with-build-time-tools=/$(PF)/nvptx-none/bin However, there is still a failure later on when the nvptx Makefile tries to run nvptx-none-gcc -dumpspecs. GCC_FOR_TARGET is set to nvptx-none-gcc in ./build-nvptx/Makefile and used in ./build-nvptx/gcc/Makefile, but there is no such command. cp xgcc gcc-cross nvptx-none-gcc -dumpspecs > tmp-specs rm -f gfortran-cross /bin/bash: line 1: nvptx-none-gcc: command not found make[4]: *** [Makefile:2226: specs] Error 127 make[4]: *** Waiting for unfinished jobs.... cp gfortran gfortran-cross rm gcc.pod gfortran.pod lto-dump.pod make[4]: Leaving directory '/<<PKGBUILDDIR>>/build-nvptx/gcc' make[3]: *** [Makefile:4622: all-gcc] Error 2 make[3]: Leaving directory '/<<PKGBUILDDIR>>/build-nvptx' make[2]: *** [Makefile:1022: all] Error 2 make[2]: Leaving directory '/<<PKGBUILDDIR>>/build-nvptx' Any ideas welcome. Full build log at: https://people.debian.org/~ema/gcc-13_13.2.0-23.1_arm64.build