When setting up avr toolchain with crossdev, the default use flags passed to the gcc package make it fail the compilation. This is caused by the openmp use flag and the error is "this gcc version can't compile programs" (don't have the exact text right now 'cause it takes a whole lot of time to compile on my box) Reproducible: Always Steps to Reproduce: 1. emerge crossdev 2. emerge -v -S --arch avr 3. watch it fail Actual Results: failed to compile gcc Expected Results: Compile the toolchain and be usable
I also encountered this bug, and, indeed, turning off the openmp USE flag on cross-avr/gcc fixed it. The exact error message is: ------ Configuring in avr/libgomp configure: creating cache ./config.cache checking for --enable-version-specific-runtime-libs... no checking for --enable-generated-files-in-srcdir... no checking build system type... x86_64-pc-linux-gnu checking host system type... avr-unknown-none checking target system type... avr-unknown-none checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for avr-strip... /usr/libexec/gcc/avr/strip checking for avr-gcc... /var/tmp/portage/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/xgcc -B/var/tmp/portage/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/./gcc/ -B/usr/avr/bin/ -B/usr/avr/lib/ -isystem /usr/avr/include -isystem /usr/avr/sys-include checking for C compiler default output file name... configure: error: in `/var/tmp/portage/cross/avr/portage/cross-avr/gcc-4.4.4-r1/work/build/avr/libgomp': configure: error: C compiler cannot create executables ------ OpenMP is of course not a lot of use on an 8-bit processor (to put it mildly), so it'd be good if crossdev turned it off by default, like all the other things it turns off.
openmp is automatically disabled now when C library lacks pthreads support http://sources.gentoo.org/eclass/toolchain.eclass?r1=1.439&r2=1.440
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37dded9b48c93a67b9a32b5eca2b1ef0fc6e8b9e commit 37dded9b48c93a67b9a32b5eca2b1ef0fc6e8b9e Author: Sam James <sam@gentoo.org> AuthorDate: 2025-04-21 06:10:28 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-04-21 06:18:14 +0000 sys-devel/gcc: add fixincludes patch to 15 too to fix openmp on regular cross targets Using lu_zero's repro instructions ... ``` $ crossdev -C riscv64 $ crossdev riscv64 -s3 $ find /usr -name pthread.h # to make sure glibc isn't doing something strange $ riscv64-unknown-linux-gnu-gcc -E - <<<"#include <pthread.h>" # this should work $ crossdev -C riscv64 $ crossdev riscv64 -s3 --g 15.0.1_pre20250418-r1 $ find /usr -name pthread.h # to make sure glibc isn't doing something strange $ riscv64-unknown-linux-gnu-gcc -E - <<<"#include <pthread.h>" # this should fail because it looks only on the compiler dir ``` ... we see that openmp.h is missing and --disable-libgomp was passed because our test in toolchain.eclass was failing: ``` # Make sure target has pthreads support: bug #326757, bug #335883 # There shouldn't be a chicken & egg problem here as openmp won't # build without a C library, and you can't build that w/o # already having a compiler... if ! is_crosscompile || $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null ; then confgcc+=( $(use_enable openmp libgomp) ) else # Force disable as the configure script can be dumb, bug #359855 confgcc+=( --disable-libgomp ) fi ``` Adding in the gcc-13-fix-cross-fixincludes.patch patch we're already using for other versions fixes it by adding /usr/${CHOST}/usr/include in the search path of the stage1 crossdev GCC. We may still want to add a workaround in toolchain.eclass like: ``` - $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null + $(tc-getCPP ${CTARGET}) -I/usr/${CTARGET}/usr/include -E - <<<"#include <pthread.h>" >& /dev/null ``` Or maybe add some warning if it failed when weren't expecting it to on some targets. I'll move this patch to gcc-patches at some point. Bug: https://gcc.gnu.org/PR115416 Bug: https://bugs.gentoo.org/326757 Bug: https://bugs.gentoo.org/335883 Bug: https://bugs.gentoo.org/905118 Bug: https://bugs.gentoo.org/909453 Bug: https://bugs.gentoo.org/925204 Bug: https://bugs.gentoo.org/926059 Thanks-to: Luca Barbato <lu_zero@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org> sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild | 1 + 1 file changed, 1 insertion(+)