Lines Matching +full:docs +full:- +full:clang +full:- +full:tools +full:- +full:man
5 -------------------
8 <https://llvm.org/docs/GettingStarted.html#getting-started-with-llvm>`_ for
12 Git browser: https://github.com/llvm/llvm-project/tree/main/lldb
15 -------------
18 In particular, it requires both Clang and LLVM itself in order to build. Due to
22 * `LLVM <https://llvm.org/docs/GettingStarted.html>`_
23 * `Clang <http://clang.llvm.org/get_started.html>`_
28 * `Ninja <https://ninja-build.org>`_ (strongly recommended)
48 By default they are auto-detected: if CMake can find the dependency it will be
54 +-------------------+--------------------------------------------------------------+--------------------------+
58 +-------------------+--------------------------------------------------------------+--------------------------+
60 +-------------------+--------------------------------------------------------------+--------------------------+
62 +-------------------+--------------------------------------------------------------+--------------------------+
64 +-------------------+--------------------------------------------------------------+--------------------------+
66 +-------------------+--------------------------------------------------------------+--------------------------+
68 +-------------------+--------------------------------------------------------------+--------------------------+
75 $ yum install libedit-devel libxml2-devel ncurses-devel python-devel swig
76 $ sudo apt-get install build-essential swig python3-dev libedit-dev libncurses5-dev libxml2-dev
78 $ pkgin install swig python38 cmake ninja-build
106 * `Python Tools for Visual Studio
138 Prompt for VS <https://docs.microsoft.com/en-us/visualstudio/ide/reference/command-prompt-powershell?view=vs-2019>`_
145 * To use the in-tree debug server on macOS, lldb needs to be code signed. For
147 * If you are building both Clang and LLDB together, be sure to also check out
151 ------------------------
155 source-tree with git:
159 $ git clone https://github.com/llvm/llvm-project.git
161 CMake is a cross-platform build-generator tool. CMake does not build the
165 <https://llvm.org/docs/CMake.html>`_.
167 Regular in-tree builds
170 Create a new directory for your build-tree. From there run CMake and point it
171 to the ``llvm`` directory in the source-tree:
175 $ cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb" [<cmake options>] path/to/llvm-project/llvm
177 We used the ``LLVM_ENABLE_PROJECTS`` option here to tell the build-system which
185 $ ninja lldb lldb-server
187 If you only want lldb, or are on a platform where lldb-server is not supported,
198 This is another way to build LLDB. We can use the same source-tree as we
199 checked out above, but now we will have multiple build-trees:
201 * the main build-tree for LLDB in ``/path/to/lldb-build``
202 * one or more provided build-trees for LLVM and Clang; for simplicity we use a
203 single one in ``/path/to/llvm-build``
205 Run CMake with ``-B`` pointing to a new directory for the provided
206 build-tree\ :sup:`1` and the positional argument pointing to the ``llvm``
207 directory in the source-tree. Note that we leave out LLDB here and only include
208 Clang. Then we build the ``ALL`` target with ninja:
212 $ cmake -B /path/to/llvm-build -G Ninja \
213 -DLLVM_ENABLE_PROJECTS=clang \
214 [<more cmake options>] /path/to/llvm-project/llvm
217 Now run CMake a second time with ``-B`` pointing to a new directory for the
218 main build-tree and the positional argument pointing to the ``lldb`` directory
219 in the source-tree. In order to find the provided build-tree, the build system
221 build directory for Clang, remember to pass its module path via ``Clang_DIR``
222 (CMake variables are case-sensitive!):
226 $ cmake -B /path/to/lldb-build -G Ninja \
227 -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
228 [<more cmake options>] /path/to/llvm-project/lldb
229 $ ninja lldb lldb-server
231 If you do not require or cannot build ``lldb-server`` on your platform, simply
236 #. The ``-B`` argument was undocumented for a while and is only officially
238 <https://cmake.org/cmake/help/v3.14/release/3.14.html#command-line>`_
246 you are likely to encounter. A variable FOO is set by adding ``-DFOO=value`` to
249 If you want to debug the lldb that you're building -- that is, build it with
250 debug info enabled -- pass two additional arguments to cmake before running
255 $ cmake -G Ninja \
256 -DLLDB_EXPORT_ALL_SYMBOLS=1 \
257 -DCMAKE_BUILD_TYPE=Debug
261 programs. If you have Clang checked out, that will be used by default.
267 $ cmake -G Ninja \
268 -DLLDB_TEST_COMPILER=<path to C compiler> \
305 $ cmake -G Ninja^
306 -DLLDB_TEST_DEBUG_TEST_CRASHES=1^
307 -DPYTHON_HOME=C:\Python35^
308 -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^
322 $ cmake -G "Visual Studio 16 2019" -A x64 -T host=x64 <cmake variables> <path to root of llvm source tree>
338 * ``LLDB_CODESIGN_IDENTITY:STRING``: Set the identity to use for code-signing
340 code-signed with identity ``lldb_codesign`` (see :ref:`CodeSigning`).
342 functional without setting up code-signing.
351 CMake scripts and can be useful to reproduce builds for particular use-cases
352 (see by analogy `usage in LLVM and Clang <https://llvm.org/docs/AdvancedBuilds.html>`_).
353 A cache is passed to CMake with the ``-C`` flag, following the absolute path to
354 the file on disk. Subsequent ``-D`` options are still allowed. Please find the
356 <https://github.com/llvm/llvm-project/tree/main/lldb/cmake/caches>`_
363 <https://github.com/llvm/llvm-project>`_ (see also `Building a Distribution of
364 LLVM <https://llvm.org/docs/BuildingADistribution.html>`_):
368 $ git clone https://github.com/llvm/llvm-project
370 $ cmake -B /path/to/lldb-build -G Ninja \
371 -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake \
372 -DLLVM_ENABLE_PROJECTS="clang;lldb" \
373 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
374 llvm-project/llvm
376 $ DESTDIR=/path/to/lldb-install ninja -C /path/to/lldb-build check-lldb install-distribution
384 $ git clone https://github.com/llvm/llvm-project
386 $ cmake -B /path/to/llvm-build -G Ninja \
387 -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-base.cmake \
388 -DLLVM_ENABLE_PROJECTS="clang" \
389 -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
390 llvm-project/llvm
391 $ ninja -C /path/to/llvm-build
393 $ cmake -B /path/to/lldb-build \
394 -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
395 -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
396 llvm-project/lldb
398 $ cmake --build /path/to/lldb-build --target check-lldb
402 The ``-B`` argument was undocumented for a while and is only officially
404 <https://cmake.org/cmake/help/v3.14/release/3.14.html#command-line>`_
408 --------------------------
423 $ sudo apt-get install doxygen graphviz swig
430 $ pip3 install -r /path/to/llvm-project/llvm/docs/requirements.txt
436 $ ninja docs-lldb-html
437 $ ninja docs-lldb-man
438 $ ninja lldb-cpp-doc
440 Cross-compiling LLDB
441 --------------------
444 of CMake at this time. Please refer to `CMake's documentation <https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html>`_
449 ``lldb-server``) for the target. While the easiest solution is to compile it
451 need to cross-compile LLDB on your host.
453 Cross-compilation is often a daunting task and has a lot of quirks which depend
456 provide an overview of the cross-compilation process along with the main things
460 for the target architecture. Since you already have a checkout of clang and
461 lldb, you can compile a host version of clang in a separate folder and use
462 that. Alternatively you can use system clang or even cross-gcc if your
463 distribution provides such packages (e.g., ``g++-aarch64-linux-gnu`` on
470 either a cross-package if one is available, or cross-compiling the respective
477 -DLLDB_ENABLE_PYTHON=0
478 -DLLDB_ENABLE_LIBEDIT=0
479 -DLLDB_ENABLE_CURSES=0
491 system with the locations and arguments of all the necessary tools.
496 binaries, you can have LLVM build the native tools for you.
499 that is and it will use those native tools instead.
501 If you are going to run ``lldb`` and ``lldb-server`` only on the target machine,
503 connect to ``lldb-server`` on the target, choose option 2.
505 Either way, the most important cmake options when cross-compiling are:
516 * ``LLVM_HOST_TRIPLE`` : The triple of the system that lldb (or lldb-server)
521 path to the llvm tools compiled for the host. Any tool that must be run on the
525 ``llvm-tblgen``, ``clang-tblgen`` and ``lldb-tblgen``. Be aware that
540 in the test suite. If you are also building clang, this will be used
545 Example 1: Cross-compiling for linux arm64 on Ubuntu host
548 Ubuntu already provides the packages necessary to cross-compile LLDB for arm64.
549 It is sufficient to install packages ``gcc-aarch64-linux-gnu``,
550 ``g++-aarch64-linux-gnu``, ``binutils-aarch64-linux-gnu``.
556 cmake <path-to-monorepo>/llvm-project/llvm -G Ninja \
557 -DCMAKE_BUILD_TYPE=Release \
558 -DLLVM_ENABLE_PROJECTS="clang;lld;lldb" \
559 -DCMAKE_SYSTEM_NAME=Linux \
560 -DCMAKE_SYSTEM_PROCESSOR=AArch64 \
561 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
562 -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
563 -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu \
564 -DLLDB_ENABLE_PYTHON=0 \
565 -DLLDB_ENABLE_LIBEDIT=0 \
566 -DLLDB_ENABLE_CURSES=0
568 During this build native tools will be built automatically when they are needed.
572 Example 2: Cross-compiling for linux arm64 on Ubuntu host using an existing host build
576 tools. Install the compiler as in example 1 then run CMake as follows:
580 cmake <path-to-monorepo>/llvm-project/llvm -G Ninja \
581 -DCMAKE_BUILD_TYPE=Release \
582 -DLLVM_ENABLE_PROJECTS="clang;lld;lldb" \
583 -DCMAKE_SYSTEM_NAME=Linux \
584 -DCMAKE_SYSTEM_PROCESSOR=AArch64 \
585 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
586 -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \
587 -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu \
588 -DLLVM_NATIVE_TOOL_DIR=<path-to-host>/bin/ \
589 -DLLDB_ENABLE_PYTHON=0 \
590 -DLLDB_ENABLE_LIBEDIT=0 \
591 -DLLDB_ENABLE_CURSES=0
596 An alternative (and recommended) way to compile LLDB is with clang.
597 Unfortunately, clang is not able to find all the include paths necessary for a
598 successful cross-compile, so we need to help it with a couple of CFLAGS
601 ``CMAKE_C(XX)_COMPILER`` to point to clang compilers):
605 -target aarch64-linux-gnu \
606 -I /usr/aarch64-linux-gnu/include/c++/4.8.2/aarch64-linux-gnu \
607 -I /usr/aarch64-linux-gnu/include
610 ``-DLLDB_ENABLE_PYTHON=0`` and other options, you would need to obtain the
612 to use the qemu-debootstrap utility, which can prepare a system image using
614 necessary packages in this environment (python-dev, libedit-dev, etc.) and
615 point your compiler to use them using the correct -I and -L arguments.
617 Example 3: Cross-compiling for Android on Linux
637 -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \
638 -DANDROID_ABI=arm64-v8a \
639 -DANDROID_PLATFORM=android-21 \
640 -DANDROID_ALLOW_UNDEFINED_SYMBOLS=On \
641 -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-android \
642 -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DCMAKE_C_COMPILER=cc;-DCMAKE_CXX_COMPILER=c++'
644 Note that currently only lldb-server is functional on android. The lldb client
648 ------------------------
658 the -P flag:
662 $ export PYTHONPATH=`$llvm/build/Debug+Asserts/bin/lldb -P`
670 $ python -c 'import lldb'
680 ---------------------
682 To use the in-tree debug server on macOS, lldb needs to be code signed. The
688 * ``scripts/macos-setup-codesign.sh``
692 cmake, specify ``-DLLDB_USE_SYSTEM_DEBUGSERVER=ON``.
694 If you have re-installed a new OS, please delete all old ``lldb_codesign`` items