Skip to content

fix(toolchain): clang cfg gains the C-header axis (v0.0.84)#198

Merged
Sunrisepeak merged 2 commits into
mainfrom
fix/clang-cfg-header-axis
Jul 7, 2026
Merged

fix(toolchain): clang cfg gains the C-header axis (v0.0.84)#198
Sunrisepeak merged 2 commits into
mainfrom
fix/clang-cfg-header-axis

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Jul 7, 2026

Copy link
Copy Markdown
Member

Companion to openxlings/xim-pkgindex#340 (which fixes the install-time cfg writer): mcpp's cfg regenerator must emit identical content, otherwise the first mcpp resolve on a machine would overwrite the corrected cfg back to the header-less form.

What: fixup_clang_cfg adds the missing header-search entries — -isystem <glibc payload>/include + -isystem <linux-headers payload>/include, ordered after the libc++ block to preserve the #include_next chain. Fixup rev → hermetic-3 so existing payloads re-converge on their next build (no reinstall required).

Scope: the cfg serves direct invocations of the bundled clang/clang++ (outside mcpp). Without these entries such invocations compile only when the host system ships /usr/include — a host-environment dependency that violates the sandbox self-containment constraint, and a hard missing-header failure on hosts without development headers. mcpp's own build path is unaffected either way (build flags come from the link model; the cfg is never read).

Verified: hermetic-3 regeneration on a real payload; direct clang/clang++ invocations with host headers masked (--sysroot=<empty dir>) compile and run; the control without the payload header entries fails as expected; unit suite + e2e 86/37 green.

Version: 0.0.84 (behavior change in a released fixup artifact + rev bump).

fixup_clang_cfg's regenerated cfg covered the link axis (-B/-L/loader/
rpath) but omitted the C library and kernel headers — a direct
`clang hello.c` only worked when the HOST happened to ship /usr/include
(silently non-hermetic; hard failure on header-less machines). The cfg
now carries -isystem for the glibc payload headers and the linux-headers
payload, ordered AFTER the libc++ block (its C-header wrappers reach libc
via #include_next) — byte-consistent with what xim-pkgindex's llvm.lua
install hook generates, so the two cfg writers can no longer diverge.

The C driver cfg (clang.cfg) gets the headers directly; the C++ cfg gets
them after the libc++ includes. Fixup rev bumped to hermetic-3 so existing
payloads re-converge on their next build. Verified with host headers
masked (--sysroot=<empty dir>): cfg-driven bare clang and clang++ both
compile and run; negative control without the payload headers fails as
expected. mcpp's own builds are unaffected (the link model has always
supplied its own header flags).
@Sunrisepeak Sunrisepeak merged commit 6f458e8 into main Jul 7, 2026
6 checks passed
@Sunrisepeak Sunrisepeak deleted the fix/clang-cfg-header-axis branch July 7, 2026 18:55
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