Skip to content

Commit 626260c

Browse files
committed
Update the docs for building libc++.
Summary: Rewrite the in-tree build to be a clearer tl;dr like we have for the out-of-tree build. Reviewers: EricWF, mclow.lists, ldionne Reviewed By: ldionne Subscribers: dexonsmith, christof, ldionne, enh, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D69917
1 parent 3be6dbc commit 626260c

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

libcxx/docs/BuildingLibcxx.rst

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,44 @@ On Mac OS 10.7 (Lion) and later, the easiest way to get this library is to insta
1616
Xcode 4.2 or later. However if you want to install tip-of-trunk from here
1717
(getting the bleeding edge), read on.
1818

19-
The basic steps needed to build libc++ are:
19+
The following instructions describe how to checkout, build, test and
20+
(optionally) install libc++ and libc++abi.
2021

21-
#. Checkout and configure LLVM (including libc++ and libc++abi), according to the `LLVM
22-
getting started <https://llvm.org/docs/GettingStarted.html>`_ documentation. Make sure
23-
to include ``libcxx`` and ``libcxxabi`` in the ``LLVM_ENABLE_PROJECTS`` option passed
24-
to CMake.
22+
If your system already provides a libc++ installation it is important to be
23+
careful not to replace it. Remember Use the CMake option
24+
``CMAKE_INSTALL_PREFIX`` to select a safe place to install libc++.
2525

26-
For more information about configuring libc++ see :ref:`CMake Options`.
27-
28-
* ``make cxx`` --- will build libc++ and libc++abi.
29-
* ``make check-cxx check-cxxabi`` --- will run the test suites.
30-
31-
Shared libraries for libc++ and libc++ abi should now be present in llvm/build/lib.
32-
See :ref:`using an alternate libc++ installation <alternate libcxx>`
33-
34-
#. **Optional**: Install libc++ and libc++abi
35-
36-
If your system already provides a libc++ installation it is important to be
37-
careful not to replace it. Remember Use the CMake option ``CMAKE_INSTALL_PREFIX`` to
38-
select a safe place to install libc++.
39-
40-
* ``make install-cxx install-cxxabi`` --- Will install the libraries and the headers
26+
.. warning::
27+
* Replacing your systems libc++ installation could render the system non-functional.
28+
* macOS will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``.
4129

42-
.. warning::
43-
* Replacing your systems libc++ installation could render the system non-functional.
44-
* macOS will not boot without a valid copy of ``libc++.1.dylib`` in ``/usr/lib``.
30+
.. code-block:: bash
4531
32+
$ git clone https://github.com/llvm/llvm-project.git
33+
$ cd llvm-project
34+
$ mkdir build && cd build
35+
$ cmake -DCMAKE_C_COMPILER=clang \
36+
-DCMAKE_CXX_COMPILER=clang++ \
37+
-DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \
38+
../llvm
39+
$ make # Build
40+
$ make check-cxx # Test
41+
$ make install-cxx install-cxxabi # Install
42+
43+
For more information about configuring libc++ see :ref:`CMake Options`. You may
44+
also want to read the `LLVM getting started
45+
<https://llvm.org/docs/GettingStarted.html>`_ documentation.
46+
47+
Shared libraries for libc++ and libc++ abi should now be present in
48+
``build/lib``. See :ref:`using an alternate libc++ installation <alternate
49+
libcxx>` for information on how to use this libc++.
4650

4751
The instructions are for building libc++ on
4852
FreeBSD, Linux, or Mac using `libc++abi`_ as the C++ ABI library.
4953
On Linux, it is also possible to use :ref:`libsupc++ <libsupcxx>` or libcxxrt.
5054

51-
It is sometimes beneficial to build separately from the full LLVM build. An
52-
out-of-tree build would look like this:
55+
It is possible to keep your LLVM and libc++ trees separate so you can avoid
56+
rebuilding LLVM as often. An out-of-tree build would look like this:
5357

5458
.. code-block:: bash
5559

0 commit comments

Comments
 (0)