From da4e0bb4a4200c44aa248403533f650d135c0a3a Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 18:21:36 +0200 Subject: [PATCH 1/3] fix(gnu.org/gcc): bottle the libc via --with-sysroot (addresses #8423) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds gnu.org/glibc + kernel.org/linux-headers as Linux deps and points gcc's configure at the bottled glibc via: --with-sysroot={{deps.gnu.org/glibc.prefix}} --with-build-sysroot={{deps.gnu.org/glibc.prefix}} --with-native-system-header-dir=/include --with-glibc-version=2.43 This embeds the bottled-glibc paths into gcc's spec file at build time. End-user `pkgx gcc test.c` resolves stdlib.h + crt*.o + libc.so.6 from the pkgx-integrated bottle — no host glibc-devel / libc6-dev needed (addresses the Fedora repro in #8423). Avoids the previous attempt's failure mode: when only the headers were exposed via CPATH but the linker found a different (older) libc, fixincl.c → libc references became unresolvable (__isoc23_strtoul). With sysroot the same libc backs both compile and link. Co-Authored-By: Claude Opus 4.7 --- projects/gnu.org/gcc/package.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/gnu.org/gcc/package.yml b/projects/gnu.org/gcc/package.yml index 5600b1b7d8..3f3f05f7b3 100644 --- a/projects/gnu.org/gcc/package.yml +++ b/projects/gnu.org/gcc/package.yml @@ -26,6 +26,13 @@ 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. + gnu.org/glibc: "*" + kernel.org/linux-headers: "*" darwin/x86-64: # since 15.1.0 libisl.sourceforge.io: ^0 @@ -197,6 +204,14 @@ build: linux: ARGS: - --disable-multilib + # Point gcc at the bottled glibc so its spec file embeds the + # search paths — end users don't need host glibc-devel and + # the build of gcc itself links against the same libc whose + # headers it includes (no __isoc23_strtoul-style mismatches). + - --with-sysroot={{deps.gnu.org/glibc.prefix}} + - --with-build-sysroot={{deps.gnu.org/glibc.prefix}} + - --with-native-system-header-dir=/include + - --with-glibc-version=2.43 linux/x86-64: LDFLAGS: - -pie From 4cbbd44166448bcf97a34bf11e5287321c29e4fe Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 19:37:27 +0200 Subject: [PATCH 2/3] fix(gcc): pin gnu.org/glibc <2.38 to avoid C23 symbol mismatch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native gcc fixincl.c was linking transitively against pkgx glibc 2.43, which exposes C23 symbol redirects (__isoc23_strtoul, …). The CI runner's underlying libc (Ubuntu 22.04, glibc 2.35) doesn't have them, hence `undefined reference to __isoc23_strtoul` at link time. Pinning to <2.38 (the version that first introduced these redirects) keeps the same sysroot mechanism but matches API surface to what the runner ships. Cross-builds were already fine because they link against the sysroot's libc directly. Co-Authored-By: Claude Opus 4.7 --- projects/gnu.org/gcc/package.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/gnu.org/gcc/package.yml b/projects/gnu.org/gcc/package.yml index 3f3f05f7b3..150ae44b58 100644 --- a/projects/gnu.org/gcc/package.yml +++ b/projects/gnu.org/gcc/package.yml @@ -31,7 +31,13 @@ dependencies: # 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. - gnu.org/glibc: "*" + # + # 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 From ba142fb64b073637287055026faf25741d4242e1 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Fri, 29 May 2026 19:43:27 +0200 Subject: [PATCH 3/3] fix(gcc): drop --with-build-sysroot (configure tests need host ld-linux) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With --with-build-sysroot=$pkgx_glibc set, configure-time test programs were linked against the sysroot's dynamic linker but with an embedded interp path of `/lib/ld-linux-x86-64.so.2` (sysroot- stripped) — that path doesn't exist on the build host, so the test programs couldn't run: configure: error: cannot run C++ compiled programs Drop --with-build-sysroot: the bootstrap compiler now uses the host's linker (so test programs run cleanly), while the installed gcc still points at pkgx-glibc via --with-sysroot for end-user invocations. Co-Authored-By: Claude Opus 4.7 --- projects/gnu.org/gcc/package.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/gnu.org/gcc/package.yml b/projects/gnu.org/gcc/package.yml index 150ae44b58..1d2e9b9fe0 100644 --- a/projects/gnu.org/gcc/package.yml +++ b/projects/gnu.org/gcc/package.yml @@ -210,14 +210,16 @@ build: linux: ARGS: - --disable-multilib - # Point gcc at the bottled glibc so its spec file embeds the - # search paths — end users don't need host glibc-devel and - # the build of gcc itself links against the same libc whose - # headers it includes (no __isoc23_strtoul-style mismatches). + # 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-build-sysroot={{deps.gnu.org/glibc.prefix}} - --with-native-system-header-dir=/include - - --with-glibc-version=2.43 + - --with-glibc-version=2.34 linux/x86-64: LDFLAGS: - -pie