Commit 1838fb2
committed
fix: skip --sysroot for std module precompile on macOS
Root cause: on macOS, xlings LLVM's clang++.cfg already contains a
--sysroot for the macOS SDK. When mcpp additionally passes --sysroot
on the command line during std module precompilation, it changes the
C header include ordering. The macOS SDK's ___wctype.h references
_CTYPE_A (defined in _ctype.h), but the duplicate --sysroot flag
prevents _ctype.h from being included transitively during module
purview compilation, causing "undeclared identifier '_CTYPE_A'" errors.
Fix: detect apple/darwin target triple in stdmod.cppm and skip the
--sysroot flag for std module precompile. The cfg's own --sysroot
handles macOS SDK discovery correctly for this compilation mode.
Regular compilation (flags.cppm) and linking still use the probed
sysroot as before.
Also restore probe_sysroot() to its original logic (xcrun fallback)
since the issue was in stdmod.cppm passing sysroot, not in probing it.1 parent e345067 commit 1838fb2
2 files changed
Lines changed: 18 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | 257 | | |
267 | 258 | | |
268 | 259 | | |
| |||
271 | 262 | | |
272 | 263 | | |
273 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
274 | 271 | | |
275 | 272 | | |
276 | 273 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
98 | 109 | | |
99 | 110 | | |
100 | 111 | | |
| |||
0 commit comments