Lines Matching +full:ninja +full:- +full:build
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
28 * `Ninja <https://ninja-build.org>`_ (strongly recommended)
30 If you want to run the test suite, you'll need to build LLDB with Python
45 LLDB's functionality. It is strongly encouraged to build LLDB with these
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
79 $ brew install swig cmake ninja
104 library if you want to build a debug lldb. The standalone installer is the
114 required dependencies such that they can be found when needed during the build
136 Any command prompt from which you build LLDB should have a valid 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
151 ------------------------
154 its subprojects. This is the recommended way to build LLDB. Check out the
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
162 project, it generates the files needed by your build tool. The recommended
163 build tool for LLVM is Ninja, but other generators like Xcode or Visual Studio
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
178 subprojects to build in addition to LLVM (for more options see
181 run ninja to perform the actual build.
185 $ ninja lldb lldb-server
187 If you only want lldb, or are on a platform where lldb-server is not supported,
188 you can pass just ``lldb``. Ninja will only build what is necessary to run the
193 $ ninja lldb
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
215 $ ninja
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
232 remove it from the Ninja command.
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
251 ninja:
255 $ cmake -G Ninja \
256 -DLLDB_EXPORT_ALL_SYMBOLS=1 \
257 -DCMAKE_BUILD_TYPE=Debug
260 If you want to run the test suite, you will need a compiler to build the test
267 $ cmake -G Ninja \
268 -DLLDB_TEST_COMPILER=<path to C compiler> \
271 It is strongly recommend to use a release build for the compiler to speed up
294 useful for developers who simply want to run LLDB after they build it. If you
295 wish to move a build of LLDB to a different machine where Python will be in a
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^
312 Building with ninja is both faster and simpler than building with Visual Studio,
315 compiling (the ninja folder), and one for editing, browsing and debugging.
322 $ cmake -G "Visual Studio 16 2019" -A x64 -T host=x64 <cmake variables> <path to root of llvm source tree>
327 ninja 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
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>`_
362 Build, test and install a distribution of LLDB from the `monorepo
363 <https://github.com/llvm/llvm-project>`_ (see also `Building a Distribution of
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
380 Build LLDB standalone for development with Xcode:
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 --------------------------
410 If you wish to build the optional (reference) documentation, additional
415 * doxygen (if you wish to build the C++ API reference)
423 $ sudo apt-get install doxygen graphviz swig
430 $ pip3 install -r /path/to/llvm-project/llvm/docs/requirements.txt
432 To build the documentation, configure with ``LLVM_ENABLE_SPHINX=ON`` and build the desired target(s).
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
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
490 Once all of the dependencies are in place, you need to configure the build
496 binaries, you can have LLVM build the native tools for you.
498 2. If you need a host build too, or already have one, you can tell CMake where
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:
508 the build target is and from this it will infer that you are cross compiling.
516 * ``LLVM_HOST_TRIPLE`` : The triple of the system that lldb (or lldb-server)
520 * ``LLVM_NATIVE_TOOL_DIR`` (only when using an existing host build): Is a
522 host during a cross build will be configured from this path, so you do not
523 need to set them all individually. If you are doing a host build only for the
524 purpose of a cross build, you will need it to include at least
525 ``llvm-tblgen``, ``clang-tblgen`` and ``lldb-tblgen``. Be aware that
539 * ``LLDB_TEST_COMPILER`` : The compiler used to build programs used
542 cross compiler you are using for the cross build.
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.
569 The contents of ``<build dir>/bin`` will be target binaries as you'd expect.
572 Example 2: Cross-compiling for linux arm64 on Ubuntu host using an existing host build
575 This build requires an existing host build that includes the required native
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
594 ``DLLVM_NATIVE_TOOL_DIR`` pointing to your existing host build.
598 successful cross-compile, so we need to help it with a couple of CFLAGS
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
609 If you wanted to build a full version of LLDB and avoid passing
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
623 The NDK also contains a cmake toolchain file, which makes configuring the build
633 arm64 build:
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`
664 If you used a different build directory or made a release build, you may need
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``
690 Note that it's possible to build and use lldb on macOS without setting up code
692 cmake, specify ``-DLLDB_USE_SYSTEM_DEBUGSERVER=ON``.
694 If you have re-installed a new OS, please delete all old ``lldb_codesign`` items
697 build folders that contained old signed items. The darwin kernel will cache
701 When you build your LLDB for the first time, the Xcode GUI will prompt you for
703 Allow" on your first build. From here on out, the ``lldb_codesign`` will be
704 trusted and you can build from the command line without having to authorize.