fix(gnu.org/gcc): bottle the libc via --with-sysroot (addresses #8423)#13092
Closed
tannevaled wants to merge 3 commits into
Closed
fix(gnu.org/gcc): bottle the libc via --with-sysroot (addresses #8423)#13092tannevaled wants to merge 3 commits into
tannevaled wants to merge 3 commits into
Conversation
…ev#8423) 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 pkgxdev#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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
Contributor
Author
|
Closing — both attempts (runtime.env CPATH, sysroot config) fail in distinct ways:
The proper fix for #8423 needs a non-build-time mechanism. Two known paths:
Leaving the issue open and revisiting later. The 9 newly-merged green PRs (#13076 #13082 #13083 #13085 #13086 #13087 #13088 #13090 #13091) are independent of this. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gnu.org/glibc+kernel.org/linux-headersas Linux runtime deps--with-sysroot={{deps.gnu.org/glibc.prefix}},--with-build-sysroot=...,--with-native-system-header-dir=/include,--with-glibc-version=2.43pkgx gcc test.cfindsstdlib.h+crt*.o+libc.so.6from the pkgx-integrated bottle, no hostglibc-devel/libc6-devneeded (Fedora repro in Inconsistencies with dnf/apt install gcc #8423).Why this approach (vs #13084's first attempt)
runtime.envexportingCPATH/LIBRARY_PATH. That:gmp.hnot found at configureundefined reference to __isoc23_strtoul(compile saw bottled glibc 2.43 headers, link saw host glibc ~2.35).--with-sysrootmechanism instead — same libc backs both compile AND link, no env-var override.Pairs with
Test plan
pkgx gcc -print-sysrootreturns the bottled glibc pathglibc-devel,pkgx gcc test.c -o testsucceeds🤖 Generated with Claude Code