Skip to content

glibc 2.42→2.43 + C23-const FTBFS fixes (make stack + gcc)#238

Draft
bryan-minimal wants to merge 11 commits into
mainfrom
update-base-soup-2026-06-11
Draft

glibc 2.42→2.43 + C23-const FTBFS fixes (make stack + gcc)#238
bryan-minimal wants to merge 11 commits into
mainfrom
update-base-soup-2026-06-11

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Jun 11, 2026

Copy link
Copy Markdown
Member

What

glibc 2.42 → 2.43, plus the C23-const FTBFS levers needed for the rebuild. Reshaped to glibc-only (binutils 2.46.1 already landed separately on main, so it's dropped here) and rebased onto current main (picks up the harnesses → stacks/ migration).

Why the two FTBFS fixes ride along

glibc 2.43 implements ISO C23 const-preserving string macros — strchr/strrchr/strstr/memchr/etc. now return const char * for a const char * argument. Pre-C23 code assigning the result to a plain char * trips -Werror=discarded-qualifiers and FTBFS. This is an ecosystem-wide wave (gcc/libgomp, libxcrypt, openssl, grub, …), so two distinct levers — and they are NOT the same kind of fix:

  1. stacks/make/stack.ncl (fleet-wide, durable) — append -Wno-error=discarded-qualifiers to the shared make-stack CFLAGS. It lands after each package's own -Werror (later flag wins), downgrading that one warning across the whole make/autotools fleet.
  2. packages/gcc/build.sh (gcc-only, interim) — gcc-15.2.0 has its own build.sh (doesn't use the make stack) and its libgomp source hits the same break, so the downgrade goes in via CFLAGS_FOR_TARGET.

⚠️ A gcc-16 bump does NOT retire the fleet lever. gcc-16 only fixes gcc's own source (its libgomp was patched upstream), so it lets us drop lever #2 (packages/gcc/build.sh). Every other C program in the fleet still trips the same break under any gcc against glibc 2.43, because the language semantics are unchanged. Lever #1 stays until either the ecosystem adopts C23-compatible source or we switch it to -std=gnu17 (restores the C17 prototypes so strchr returns char * — no warning at all, but a broader language-standard change). That -Wno-error vs -std=gnu17 choice is the toolchain-policy call this is parked on.

Changes

  • packages/glibc/build.ncl — 2.42 → 2.43 (+ sha256)
  • stacks/make/stack.ncl — fleet-wide -Wno-error=discarded-qualifiers (durable)
  • packages/gcc/build.sh — same downgrade via CFLAGS_FOR_TARGET for gcc's own build (interim, retired by gcc-16)

Status

Draft — toolchain-policy change (touches every C build). glibc 2.43 clears the glibc CVE backlog (CVE-2025-15281 + CVE-2026-5450 CRIT, etc.).

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 12c7eb48-cac4-4333-aab5-ab8bf862f10c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR updates build inputs and build flags: it bumps binutils to 2.46.1, bumps glibc to 2.43 (each with updated sha256), and adds a GCC build workaround that appends -Wno-error=discarded-qualifiers to CFLAGS/CXXFLAGS and propagates it to target flags.

Changes

Build inputs and build-script changes

Layer / File(s) Summary
Binutils version bump
packages/binutils/build.ncl
Binutils source version updated from 2.46.0 to 2.46.1 and the sha256 for binutils-%{version}.tar.xz replaced.
Glibc version bump
packages/glibc/build.ncl
Glibc source version updated from 2.42 to 2.43 and the sha256 for glibc-%{version}.tar.xz replaced.
GCC build flags workaround
packages/gcc/build.sh
Add -Wno-error=discarded-qualifiers to CFLAGS/CXXFLAGS and propagate to CFLAGS_FOR_TARGET/CXXFLAGS_FOR_TARGET to avoid build errors with glibc 2.43.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A tiny hop through build and flags,
Versions nudged and checksums tagged,
CFLAGS whisper "please be mild",
Targets build without a child,
Happy trees of code, all neatly filed.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title directly and accurately summarizes the main changes: glibc version bump (2.42→2.43) and the C23 const-related FTBFS fixes applied to the GCC build configuration.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-base-soup-2026-06-11

Comment @coderabbitai help to get the list of available commands and usage tips.

The base-soup rebuild recompiles gcc-15.2.0 against the new glibc 2.43
headers, which implement ISO C23 const-preserving string macros (strchr
et al. now return `const char *` for a `const char *` input). gcc-15.2.0
predates this, so libgomp/affinity-fmt.c (`char *q = strchr(p+1,'}')`)
discards const and fails -Werror=discarded-qualifiers — the FTBFS the
buildbot hit. The pointer is only used for `q - p`, never written, so
it's a source-pedantry mismatch, not a runtime bug.

Downgrade only that single warning (everything else stays -Werror) via
CFLAGS_FOR_TARGET (the documented knob for target libs like libgomp) +
CFLAGS, for gcc's own build only — the shipped compiler is byte-identical.

Interim escape hatch; gcc-16.1.0 fixes this upstream and builds cleanly
against glibc 2.43 (LFS pairs them with no workaround), so the clean
follow-up is bumping gcc to 16. This is the same C23 wave hitting the
whole ecosystem (openssl, grub, libevent, ...). Refs in build.sh.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bryan-minimal

Copy link
Copy Markdown
Member Author

Added: gcc glibc-2.43 build fix (commit 4cf505f)

The first buildbot run failed building gcc-15.2.0 against the new glibc 2.43 headers — not glibc/binutils themselves. glibc 2.43 implements ISO C23 const-preserving string macros: strchr/strrchr/strstr/memchr/… now return const char * for a const char * input. gcc-15.2.0 predates this, so libgomp/affinity-fmt.c (char *q = strchr(p+1,'}')) discards const-Werror=discarded-qualifiers → FTBFS.

This is the same C23 wave hitting the whole ecosystem right now (openssl, grub, libevent, criu, …) — a known, documented event, not anything specific to us.

Fix here (interim, surgical): -Wno-error=discarded-qualifiers via CFLAGS_FOR_TARGET (the documented knob for target libs like libgomp) for gcc's own build only. It downgrades exactly that one warning — everything else stays -Werror — and the shipped compiler is byte-identical. The pointer is only used for q - p, never written, so it's source-pedantry, not a runtime bug.

Clean follow-up: bump gcc → 16.1.0, which fixes this upstream and builds against glibc 2.43 with no workaround (LFS pairs them directly). That retires the band-aid; tracked separately as it's a major-version migration.

Refs are also inline in packages/gcc/build.sh.

@bryan-minimal bryan-minimal marked this pull request as draft June 11, 2026 03:03
@bryan-minimal

Copy link
Copy Markdown
Member Author

🚧 Moved to draft — needs a team decision on the glibc-2.43 C23 wave

Second buildbot run got past gcc but then libxcrypt failed with the identical pattern:

lib/crypt-gost-yescrypt.c:134: error: initialization discards 'const' qualifier ... [-Werror=discarded-qualifiers]
  char *hptr = strchr ((const char *) intbuf->retval + 3, '$');

So this is confirmed fleet-wide, not a gcc one-off (see the previous comment for root cause: glibc 2.43's ISO C23 const-preserving string macros). Patching package-by-package is whack-a-mole, and gcc 16.1.0 would not help — it only fixes gcc's own source, not libxcrypt/openssl/grub/etc.

The systematic fix: one line in the shared make harness

The flags that land after each package's -Werror come from harnesses/make/harness.ncl:

# harnesses/make/harness.ncl:9
CFLAGS = "-O2 -pipe -gno-record-gcc-switches",

Because these are appended last on every compile (confirmed in libxcrypt's command line: … -Werror -fno-plt -march=… -O2 -pipe -gno-record-gcc-switches …), adding the override here downgrades the one warning fleet-wide for every make/autotools package, in a single line:

-    CFLAGS = "-O2 -pipe -gno-record-gcc-switches",
+    CFLAGS = "-O2 -pipe -gno-record-gcc-switches -Wno-error=discarded-qualifiers",

gcc has a custom build.sh, so it's handled separately (the commit already in this PR). A handful of CMake/meson packages have their own harnesses — if any of those break, the same one-line override applies to harnesses/cmake / harnesses/meson.

Why this is safe (but is a band-aid)

  • Downgrades exactly one warning (discarded-qualifiers) error→warning; every other -Werror stays.
  • The flagged code is runtime-safe — it's the old C17 char *q = strchr(const…) pattern where the pointer isn't written; byte-identical output.
  • It does not change the language standard or any ABI.
  • Tech debt: it masks the not-yet-const-correct code rather than fixing it. We unwind it when we adopt C23 properly.

Decision for the team

Option Effect Cost
Global -Wno-error=discarded-qualifiers in harness (proposed) Whole wave gone, glibc 2.43 + CVEs land now Band-aid / tech debt
-std=gnu17 in harness Broader — turns off all C23, not just this warning Bigger hammer; also masks future C23 issues
Per-package const patches (what distros/upstreams do) "Correct" C23-forward Whack-a-mole across N packages
Hold glibc 2.43 Safe, no churn glibc CVEs stay unpatched
Bump gcc → 16.1.0 Fixes gcc only — does NOT address libxcrypt/others Major-version migration, doesn't solve the wave

My recommendation: the global -Wno-error=discarded-qualifiers harness override is the pragmatic way to land glibc 2.43 (and clear the CVEs) now without whack-a-mole, then do the const-correct per-package fixes (or a gcc-16 bump) as deliberate follow-up. But this touches every C build, so it's a deliberate toolchain-policy call — hence draft + this writeup for discussion.

Refs: glibc 2.43 C23 const macros · GCC CFLAGS_FOR_TARGET docs · LFS GCC-16.1.0

bryan-minimal and others added 2 commits June 16, 2026 12:57
…2.43 C23 rebuild

glibc 2.43's ISO C23 const-preserving string macros (strchr/strstr/memchr/...
return `const char *` for const input) cause an ecosystem-wide
-Werror=discarded-qualifiers FTBFS wave. The make stack's shared CFLAGS land
after each package's own -Werror on the compile line, so appending the
downgrade here fixes the whole make/autotools fleet in one place. Interim
until a gcc-16 bump (which fixes it upstream).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@bryan-minimal bryan-minimal changed the title Update base-soup: 2 packages glibc 2.42→2.43 + C23-const FTBFS fixes (make stack + gcc) Jun 16, 2026
bryan-minimal and others added 6 commits June 16, 2026 13:00
…ires gcc/build.sh

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…TBFS

libxcrypt has a hand-written build.sh that *assigns* CFLAGS (not the make
stack), so the stacks/make/stack.ncl fleet lever from this PR can't reach it.
Its crypt-{gost,sm3}-yescrypt.c assign const-qualified strchr() results to a
plain char*, tripping libxcrypt's own configure-enabled -Werror under glibc
2.43's ISO C23 const-preserving string macros. Downgrade only that one warning,
appended after -Werror so the later flag wins.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
elfutils hardcodes CFLAGS in its build.sh (bypasses the make stack) and
defaults -Werror on. glibc 2.43's ISO C23 const-preserving bsearch/strchr-family
lookups discard const into plain pointers (libcpu/riscv_disasm.c known_csrs
bsearch), tripping -Werror=discarded-qualifiers. elfutils is notorious for
multiple distinct -Werror trips across toolchain bumps, so use its own
--disable-werror off-switch rather than chase warnings one flag at a time.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…disable-werror unrecognized)

elfutils' configure has no --disable-werror in this version (it warned
'unrecognized options: --disable-werror' and kept -Werror on, so the C23
discarded-qualifiers trip in libcpu/riscv_disasm.c persisted). Use the same
surgical CFLAGS flag as libxcrypt instead: automake emits $(AM_CFLAGS)
$(CFLAGS), and elfutils' -Werror lives in AM_CFLAGS, so a -Wno-error in CFLAGS
lands after it on the compile line and wins. The whole libelf tree compiled
clean before the single trip, so the one warning is the only break.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
strace hardcodes CFLAGS in build.sh (bypasses make stack) and self-enables
-Werror. glibc 2.43's ISO C23 const-preserving bsearch returns const for a
const arg; src/ioctl.c assigns it to a plain pointer (iop = bsearch(...,
ioctlent, ...)). Downgrade only that warning, appended after strace's -Werror
on the compile line so the later flag wins. Same glibc-2.43 C23 class as #238.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…reads collision

or-tools FetchContent's SCIP v10.0.0, which bundles tinycthread (a C11
<threads.h> shim doing `#define once_flag pthread_once_t`). glibc 2.43 surfaces
its native once_flag/call_once into SCIP's TU, so that macro corrupts glibc's
`typedef __once_flag once_flag;` into a pthread_once_t redefinition -> hard
"conflicting types" FTBFS (not the -Werror class; -Wno-error can't help).

or-tools 9.15 is already the latest release and pins current SCIP, so no version
bump escapes it. or-tools hard-FORCEs SCIP TPI=tny in its bundled cmake, so a
-DTPI=... is overridden. sed the forced TPI to omp before cmake: SCIP uses its
OpenMP task interface (no tinycthread), staying parallel + THREADSAFE (SCIP
auto-forces THREADSAFE on for non-none TPI). libgomp is present from gcc. A grep
guard fails the build loudly if upstream renames the line. Leaf package (nothing
depends on it) but in the glibc closure, so it must build. glibc-2.43 class, #238.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant