commit:     37dded9b48c93a67b9a32b5eca2b1ef0fc6e8b9e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 21 06:10:28 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Apr 21 06:18:14 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=37dded9b

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 <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild 
b/sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild
index 06d32297706e..292a75bc7f1f 100644
--- a/sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild
+++ b/sys-devel/gcc/gcc-15.0.1_pre20250418-r1.ebuild
@@ -52,6 +52,7 @@ src_prepare() {
        done
 
        toolchain_src_prepare
+       eapply "${FILESDIR}"/${PN}-13-fix-cross-fixincludes.patch
        eapply "${FILESDIR}"/${P}-PR119858.patch
        eapply_user
 }

Reply via email to