Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

When setting RUNTIMES_USE_LIBC=libc we pass -nostdlibinc if the compiler
supports it. This causes compilation failures when trying to build
libc++ as libc will try and reference kernel headers in its own headers
that it now cannot find. Explicitly reference the kernel headers so the
compiler can find them.

Created using spr 1.3.7
@boomanaiden154 boomanaiden154 requested a review from a team as a code owner October 25, 2025 19:39
@llvmbot llvmbot added the cmake Build system in general and CMake in particular label Oct 25, 2025
Created using spr 1.3.7
Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, though you should probably double check how the cmake variable definition ordering works on this. LIBC_KERNEL_HEADERS is intended to be passed by the user but it also has a default value that might not get picked up on a fresh build

@boomanaiden154 boomanaiden154 changed the title [Runtimes][libc] Include kernel headers when using RUNIMES_USE_LIBC [Runtimes][libc] Include kernel headers when using RUNTIMES_USE_LIBC Oct 31, 2025
@boomanaiden154
Copy link
Contributor Author

LGTM, though you should probably double check how the cmake variable definition ordering works on this. LIBC_KERNEL_HEADERS is intended to be passed by the user but it also has a default value that might not get picked up on a fresh build

Ah, good point to check. We have to run it after HandleLibC is invoked because we need to tag this against the runtime-libc-headers target that is created there. The setup if LIBC_KERNEL_HEADERS happens pretty early in libc/CMakeLists.txt. Given runtimes/CMakeLists.txt explicitly handles ordering CMake configuration of the runtime libraries to respect layering rules, we'll have LIBC_KERNEL_HEADERS available whenever HandleLibC is invoked.

@boomanaiden154 boomanaiden154 merged commit 43bd7e3 into main Nov 1, 2025
77 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/runtimeslibc-include-kernel-headers-when-using-runimes_use_libc branch November 1, 2025 19:50
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Nov 1, 2025
…S_USE_LIBC

When setting RUNTIMES_USE_LIBC=libc we pass -nostdlibinc if the compiler
supports it. This causes compilation failures when trying to build
libc++ as libc will try and reference kernel headers in its own headers
that it now cannot find. Explicitly reference the kernel headers so the
compiler can find them.

Reviewers: vonosmas, petrhosek, #reviewers-libcxx, michaelrj-google

Reviewed By: michaelrj-google

Pull Request: llvm/llvm-project#165114
DEBADRIBASAK pushed a commit to DEBADRIBASAK/llvm-project that referenced this pull request Nov 3, 2025
When setting RUNTIMES_USE_LIBC=libc we pass -nostdlibinc if the compiler
supports it. This causes compilation failures when trying to build
libc++ as libc will try and reference kernel headers in its own headers
that it now cannot find. Explicitly reference the kernel headers so the
compiler can find them.

Reviewers: vonosmas, petrhosek, #reviewers-libcxx, michaelrj-google

Reviewed By: michaelrj-google

Pull Request: llvm#165114
ckoparkar pushed a commit to ckoparkar/llvm-project that referenced this pull request Nov 6, 2025
When setting RUNTIMES_USE_LIBC=libc we pass -nostdlibinc if the compiler
supports it. This causes compilation failures when trying to build
libc++ as libc will try and reference kernel headers in its own headers
that it now cannot find. Explicitly reference the kernel headers so the
compiler can find them.

Reviewers: vonosmas, petrhosek, #reviewers-libcxx, michaelrj-google

Reviewed By: michaelrj-google

Pull Request: llvm#165114
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cmake Build system in general and CMake in particular

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants