Skip to content

[libc] Fix missing sysroot path for kernel headers when crosscompiling #99588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libc/cmake/modules/LLVMLibCCompileOptionRules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ function(_get_common_compile_options output_var flags)
(LIBC_CC_SUPPORTS_NOSTDLIBINC OR COMPILER_RESOURCE_DIR))
# We use -idirafter to avoid preempting libc's own headers in case the
# directory (e.g. /usr/include) contains other headers.
list(APPEND compile_options "-idirafter${LIBC_KERNEL_HEADERS}")
if(CMAKE_CROSSCOMPILING)
list(APPEND compile_options "-idirafter=${LIBC_KERNEL_HEADERS}")
else()
list(APPEND compile_options "-idirafter${LIBC_KERNEL_HEADERS}")
endif()
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion libc/src/time/linux/nanosleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//

#include "src/time/nanosleep.h"

#include "hdr/time_macros.h"
Copy link
Member

Choose a reason for hiding this comment

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

This change seems unrelated, can you move it to a separate PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

I forgot to mention it in the commit message, but once we fix the sysroot path, the compilation of the file fails in rv32 due to the missing definition of CLOCK_REALTIME.

I'll update the commit message when squashing and merging

#include "src/__support/OSUtil/syscall.h" // For syscall functions.
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
Expand Down
Loading