Files
Konstantin BogdanovandClaude Fable 5 3e8e4ad35d Stop falling back to glibc sysroot headers in musl builds
The glibc userspace headers from the sysroot were reachable in every
compilation through clang's builtin sysroot search path, so any header
musl does not provide (or does not win in the include order) silently
fell back to glibc declarations without a link-time signal; the
execinfo.h stub was one manually-shadowed example. The AI reviewer
suggested narrowing the fallback to the kernel headers only.

Compile everything with -nostdlibinc and pass the musl include
directories explicitly in the toolchain flags. The kernel (uapi)
headers, the only part of the sysroot that must stay reachable, are
whitelisted through a directory of symlinks created at configure time
in cmake/musl.cmake. A header musl does not provide is now a compile
error: for example, #include <gnu/libc-version.h> fails with "file not
found", while execinfo.h resolves to the stub and linux/asm headers to
the whitelist.

The two target_include_directories(global-libs ...) blocks removed here
were inert: only INTERFACE_LINK_LIBRARIES of global-libs is forwarded
to global-group, so these directories never appeared on any compile
line; the fallback came from the builtin sysroot path, which
-nostdlibinc disables.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-03 01:39:24 +02:00
..