@@ -28,6 +28,10 @@ development. In this we've set the Ninja generator, set the build type to
28
28
"Debug", and enabled the Scudo allocator. This build also enables generating the
29
29
documentation and verbose cmake logging, which are useful development features.
30
30
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
+
31
35
.. note ::
32
36
if your build fails with an error saying the compiler can't find
33
37
``<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.
50
54
-DLLVM_LIBC_FULL_BUILD=ON \
51
55
-DCMAKE_BUILD_TYPE=Debug \
52
56
-DLLVM_LIBC_INCLUDE_SCUDO=ON \
57
+ -DLLVM_LIBC_KERNEL_HEADERS=/path/to/kernel/headers/ \
53
58
-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON \
54
59
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
55
60
-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF \
@@ -133,6 +138,7 @@ allocator for LLVM-libc.
133
138
-DCMAKE_CXX_COMPILER=clang++ \
134
139
-DLLVM_LIBC_FULL_BUILD=ON \
135
140
-DLLVM_LIBC_INCLUDE_SCUDO=ON \
141
+ -DLLVM_LIBC_KERNEL_HEADERS=/path/to/kernel/headers/ \
136
142
-DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON \
137
143
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
138
144
-DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF \
@@ -171,6 +177,8 @@ toolchain with which you can build practical/real-world C applications. See
171
177
`<https://github.com/llvm/llvm-project/tree/main/libc/examples >`_ for examples
172
178
of how to start using this new toolchain.
173
179
180
+ .. _linux_headers :
181
+
174
182
Linux Headers
175
183
=============
176
184
@@ -183,7 +191,9 @@ Linux headers in your sysroot. Let's build them from source.
183
191
$> make LLVM=1 INSTALL_HDR_PATH=/path/to/sysroot -C /tmp/linux headers_install
184
192
185
193
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.
187
197
188
198
Using your newly built libc
189
199
===========================
0 commit comments