diff --git a/projects/gnu.org/gcc/package.yml b/projects/gnu.org/gcc/package.yml index 5600b1b7d8..1d2e9b9fe0 100644 --- a/projects/gnu.org/gcc/package.yml +++ b/projects/gnu.org/gcc/package.yml @@ -26,6 +26,19 @@ dependencies: gnu.org/mpfr: ">=2.4.0" gnu.org/mpc: ">=0.8.0" zlib.net: ^1.3 + linux: + # Bottle the libc the compiler targets so end-user `pkgx gcc test.c` + # finds stdlib.h + crt*.o + libc.so.6 from the pkgx-integrated bottle + # without needing host glibc-devel / libc6-dev. See #8423. + # gcc's spec file embeds these paths via --with-sysroot below. + # + # Pin <2.38: glibc 2.38 introduced C23 symbol redirects + # (__isoc23_strtoul, __isoc23_*scanf, …) that the runner's older + # glibc lacks, so native gcc's own fixincl.c link fails with + # `undefined reference to __isoc23_strtoul`. Cross-builds were + # unaffected because they link against the sysroot's libc directly. + gnu.org/glibc: "<2.38" + kernel.org/linux-headers: "*" darwin/x86-64: # since 15.1.0 libisl.sourceforge.io: ^0 @@ -197,6 +210,16 @@ build: linux: ARGS: - --disable-multilib + # Install-time sysroot only: the built gcc embeds pkgx glibc + # paths so end-user `pkgx gcc test.c` finds stdlib.h + crt*.o. + # --with-build-sysroot is intentionally NOT set: configure + # tests need to run compiled programs at build time, which + # requires the host's dynamic linker (sysroot's ld-linux is + # at /opt/.../glibc/v.../lib not /lib so an embedded /lib/ + # interp path won't resolve). + - --with-sysroot={{deps.gnu.org/glibc.prefix}} + - --with-native-system-header-dir=/include + - --with-glibc-version=2.34 linux/x86-64: LDFLAGS: - -pie