Commit 29a8c6e
committed
The compile side closes the host's C library the link side already dropped (#662)
Target-side header isolation had a half. The link side has read
`plan.targetSide.cAbi.prebuilt()` since #511 and dropped `-nostdlib` whenever
a package supplies the target's C library; the compile side never got the
same treatment, so clang's own driver kept searching the host's system
directories. On a machine that happens to have the matching host headers
(mingw-w64, in the issue's repro) the two C libraries' declarations collide
and the error names neither the host header nor why it was read; on a machine
without them the failure is a bare "file not found" with no explanation.
There is a same-shaped C++ twin: the existing `-nostdinc++` condition asked
`!graphSuppliesTarget && !cxxFromPayload`, which is false exactly when BOTH
layers come from the graph — the openkal shape — so the driver kept finding
the host's libstdc++ beside itself. The issue's own minimal repro only
`import std`s and never text-includes a header, so it exposed neither half.
- `mcpp.toolchain.hostflags` appends `-nostdlibinc` when the C library comes
from the graph, and fixes the `-nostdinc++` condition to read only whether
the C++ layer comes from the graph. Both tokens live in the global
`cflags`/`cxxflags`/`asmflags` producer, so every consumer (C, C++, asm,
`clang-scan-deps`, the std module precompile) gets them identically.
- GCC has no one-token equivalent. `can_isolate_graph_c_library` states the
capability in the toolchain model (Clang only); `prepare.cppm` refuses the
combination at resolution when it would otherwise reach an unisolated
build, rather than silently skipping isolation. No target row needs the
GCC form today.
- `mcpp::build::graph_c_library_isolation_advice`, the compile-side sibling
of `link_failure_advice`: when a failed build's raw ninja output carries
both the isolating token and a "file not found", it appends a note naming
the C library and two remedies (adapt on `cfg(c-abi = "...")`, or bring the
platform headers into the graph as a private dependency of the package that
needs them) without rewriting the compiler's own line.
- M5: verified rather than assumed that a `[feature-deps.<feature>]` entry
can already stay private to its declaring package (`visibility =
"private"`, folding only into `privateBuild`, never into `publicUsage`) —
measured both directions with local path packages before writing e2e 739.
The capability already existed and was undocumented; docs/06 now states
the pattern and docs/24 gains a "boundary" section (kernel-abi vs c-abi,
one C/C++ runtime per image, adapt on the differing layer, no source-level
implementation detection) — both in English and zh.
- Unit tests: the option matrix (`cAbiPrebuilt` x `cxxFromGraph` x
{clang, gcc}), a byte-identical regression guard for payload-served
builds, and `graph_c_library_isolation_advice`'s own matching rules.
- e2e 738: openkal's `x86_64-windows-gnu` build, each C/C++ unit's actual
command from the build database re-run with `-v -fsyntax-only`, asserting
clang's own header search list names only store paths. Red before this fix
(confirmed locally, both the C and the C++ twin), green after. Gated on a
`mingw-host-headers` capability (the criterion has no discriminating power
without a host mingw to have leaked in); `openkal-cross.yml`'s
`ecosystem-e2e` job installs `mingw-w64` so it holds in CI, since `llvm` —
which 738 also requires — is never in `run_all.sh`'s detected CAPS on any
sharded runner.
- e2e 739: the private-feature-dep guarantee, in both directions on the same
two packages so the harness cannot pass vacuously.
- Version 2026.9.17.3.1 parent 9bc00f8 commit 29a8c6e
21 files changed
Lines changed: 1150 additions & 9 deletions
File tree
- .agents/docs
- .github/workflows
- docs
- zh
- modules
- toolchain-model/src
- versioning/src
- src
- build
- toolchain
- tests
- e2e
- unit
Lines changed: 224 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
| 389 | + | |
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| |||
402 | 402 | | |
403 | 403 | | |
404 | 404 | | |
405 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
406 | 415 | | |
407 | 416 | | |
408 | 417 | | |
| |||
423 | 432 | | |
424 | 433 | | |
425 | 434 | | |
426 | | - | |
| 435 | + | |
| 436 | + | |
427 | 437 | | |
428 | 438 | | |
429 | 439 | | |
| |||
475 | 485 | | |
476 | 486 | | |
477 | 487 | | |
| 488 | + | |
| 489 | + | |
478 | 490 | | |
0 commit comments