@@ -28,6 +28,10 @@ development. In this we've set the Ninja generator, set the build type to
2828"Debug", and enabled the Scudo allocator. This build also enables generating the
2929documentation and verbose cmake logging, which are useful development features.
3030
31+ If targeting Linux, see :ref: `linux_headers ` for how to build the Linux kernel
32+ headers from source, which llvm-libc will depend on. If not targeting Linux,
33+ the below cmake variable ``LIBC_KERNEL_HEADERS `` should be omitted.
34+
3135.. note ::
3236 if your build fails with an error saying the compiler can't find
3337 ``<asm/unistd.h> `` or similar then you're probably missing the symlink from
@@ -50,6 +54,7 @@ documentation and verbose cmake logging, which are useful development features.
5054 -DLLVM_LIBC_FULL_BUILD=ON \
5155 -DCMAKE_BUILD_TYPE=Debug \
5256 -DLLVM_LIBC_INCLUDE_SCUDO=ON \
57+ -DLLVM_LIBC_KERNEL_HEADERS=/path/to/kernel/headers/ \
5358 -DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON \
5459 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
5560 -DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF \
@@ -133,6 +138,7 @@ allocator for LLVM-libc.
133138 -DCMAKE_CXX_COMPILER=clang++ \
134139 -DLLVM_LIBC_FULL_BUILD=ON \
135140 -DLLVM_LIBC_INCLUDE_SCUDO=ON \
141+ -DLLVM_LIBC_KERNEL_HEADERS=/path/to/kernel/headers/ \
136142 -DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON \
137143 -DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
138144 -DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF \
@@ -171,6 +177,8 @@ toolchain with which you can build practical/real-world C applications. See
171177`<https://github.com/llvm/llvm-project/tree/main/libc/examples >`_ for examples
172178of how to start using this new toolchain.
173179
180+ .. _linux_headers :
181+
174182Linux Headers
175183=============
176184
@@ -183,7 +191,9 @@ Linux headers in your sysroot. Let's build them from source.
183191 $> make LLVM=1 INSTALL_HDR_PATH=/path/to/sysroot -C /tmp/linux headers_install
184192
185193 The headers can be built to target non-host architectures by adding the
186- ``ARCH={arm|arm64|i386} `` to the above invocation of ``make ``.
194+ ``ARCH={arm|arm64|i386} `` to the above invocation of ``make ``. Then you should
195+ set the cmake variable `-DLIBC_KERNEL_HEADERS=/path/to/sysroot ` when
196+ configuring llvm-libc.
187197
188198Using your newly built libc
189199===========================
0 commit comments