[libc-commits] [libc] [libc][docs] Update docs to reflect new headergen (PR #102381)
via libc-commits
libc-commits at lists.llvm.org
Fri Aug 16 10:37:39 PDT 2024
================
@@ -8,27 +8,97 @@ Full Host Build
:depth: 1
:local:
+.. note::
+ Fullbuild requires running headergen, which is a python program that depends on
+ pyyaml. The minimum versions are listed on the :ref:`header_generation`
+ page, as well as additional information.
+
In this document, we will present a recipe to build the full libc for the host.
When we say *build the libc for the host*, the goal is to build the libc for
-the same system on which the libc is being built. Also, we will take this
-opportunity to demonstrate how one can set up a *sysroot* (see the documentation
+the same system on which the libc is being built. First, we will explain how to
+build for developing LLVM-libc, then we will explain how to build LLVM-libc as
+part of a complete toolchain.
+
+Configure the build for development
+===================================
+
+
+Below is the list of commands for a simple recipe to build LLVM-libc for
+development. In this we've set the Ninja generator, set the build type to
+"Debug", and enabled the Scudo allocator. This build also enables generating the
+documentation and verbose cmake logging, which are useful development features.
+
+.. note::
+ if your build fails with an error saying the compiler can't find
+ ``<asm/unistd.h>`` or similar then you're probably missing the symlink from
+ ``/usr/include/asm`` to ``/usr/include/<HOST TRIPLE>/asm``. Installing the
+ ``gcc-multilib`` package creates this symlink, or you can do it manually with
+ this command:
+ ``sudo ln -s /usr/include/<HOST TRIPLE>/asm /usr/include/asm``
+ (your host triple will probably be similar to ``x86_64-linux-gnu``)
+
+.. code-block:: sh
+
+ $> cd llvm-project # The llvm-project checkout
+ $> mkdir build
+ $> cd build
+ $> cmake ../runtimes \
+ -G Ninja \
+ -DCMAKE_C_COMPILER=clang \
+ -DCMAKE_CXX_COMPILER=clang++ \
+ -DLLVM_ENABLE_RUNTIMES="libc;compiler-rt" \
+ -DLLVM_LIBC_FULL_BUILD=ON \
+ -DCMAKE_BUILD_TYPE=Debug \
+ -DLLVM_LIBC_INCLUDE_SCUDO=ON \
+ -DCOMPILER_RT_BUILD_SCUDO_STANDALONE_WITH_LLVM_LIBC=ON \
+ -DCOMPILER_RT_BUILD_GWP_ASAN=OFF \
+ -DCOMPILER_RT_SCUDO_STANDALONE_BUILD_SHARED=OFF \
+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
+ -DLLVM_ENABLE_SPHINX=ON -DLIBC_INCLUDE_DOCS=ON \
+ -DLIBC_CMAKE_VERBOSE_LOGGING=ON
+
+Build and test
+==============
+
+After configuring the build with the above ``cmake`` command, one can build test
+libc with the following command:
+
+.. code-block:: sh
+
+ $> ninja libc check-libc
----------------
lntue wrote:
right now in full build `libm.a` is built separately with `ninja libm`. You might want to add it here, until we combine their cmake targets for full build similar to overlay mode.
https://github.com/llvm/llvm-project/pull/102381
More information about the libc-commits
mailing list