1Building 2======== 3 4.. contents:: 5 :local: 6 7Getting the Sources 8------------------- 9 10Please refer to the `LLVM Getting Started Guide 11<https://llvm.org/docs/GettingStarted.html#getting-started-with-llvm>`_ for 12general instructions on how to check out the LLVM monorepo, which contains the 13LLDB sources. 14 15Git browser: https://github.com/llvm/llvm-project/tree/master/lldb 16 17Preliminaries 18------------- 19 20LLDB relies on many of the technologies developed by the larger LLVM project. 21In particular, it requires both Clang and LLVM itself in order to build. Due to 22this tight integration the Getting Started guides for both of these projects 23come as prerequisite reading: 24 25* `LLVM <https://llvm.org/docs/GettingStarted.html>`_ 26* `Clang <http://clang.llvm.org/get_started.html>`_ 27 28The following requirements are shared on all platforms. 29 30* `CMake <https://cmake.org>`_ 31* `Ninja <https://ninja-build.org>`_ (strongly recommended) 32 33If you want to run the test suite, you'll need to build LLDB with Python 34scripting support. 35 36* `Python <http://www.python.org/>`_ 37* `SWIG <http://swig.org/>`_ 2 or later. 38 39Optional Dependencies 40********************* 41 42Although the following dependencies are optional, they have a big impact on 43LLDB's functionality. It is strongly encouraged to build LLDB with these 44dependencies enabled. 45 46By default they are auto-detected: if CMake can find the dependency it will be 47used. It is possible to override this behavior by setting the corresponding 48CMake flag to ``On`` or ``Off`` to force the dependency to be enabled or 49disabled. When a dependency is set to ``On`` and can't be found it will cause a 50CMake configuration error. 51 52+-------------------+------------------------------------------------------+--------------------------+ 53| Feature | Description | CMake Flag | 54+===================+======================================================+==========================+ 55| Editline | Generic line editing, history, Emacs and Vi bindings | ``LLDB_ENABLE_LIBEDIT`` | 56+-------------------+------------------------------------------------------+--------------------------+ 57| Curses | Text user interface | ``LLDB_ENABLE_CURSES`` | 58+-------------------+------------------------------------------------------+--------------------------+ 59| LZMA | Lossless data compression | ``LLDB_ENABLE_LZMA`` | 60+-------------------+------------------------------------------------------+--------------------------+ 61| Libxml2 | XML | ``LLDB_ENABLE_LIBXML2`` | 62+-------------------+------------------------------------------------------+--------------------------+ 63| Python | Python scripting | ``LLDB_ENABLE_PYTHON`` | 64+-------------------+------------------------------------------------------+--------------------------+ 65| Lua | Lua scripting | ``LLDB_ENABLE_LUA`` | 66+-------------------+------------------------------------------------------+--------------------------+ 67 68Depending on your platform and package manager, one might run any of the 69commands below. 70 71:: 72 73 > yum install libedit-devel libxml2-devel ncurses-devel python-devel swig 74 > sudo apt-get install build-essential subversion swig python3-dev libedit-dev libncurses5-dev 75 > pkg install swig python 76 > pkgin install swig python27 cmake ninja-build 77 > brew install swig cmake ninja 78 79Note that there's an `incompatibility 80<https://github.com/swig/swig/issues/1321>` between Python version 3.7 and later 81and swig versions older than 4.0.0 which makes builds of LLDB using debug 82versions of python unusable. This primarily affects Windows, as debug builds of 83LLDB must use debug python as well. 84 85Windows 86******* 87 88* Visual Studio 2017. 89* The latest Windows SDK. 90* The Active Template Library (ATL). 91* `GnuWin32 <http://gnuwin32.sourceforge.net/>`_ for CoreUtils and Make. 92* `Python 3 <https://www.python.org/downloads/windows/>`_. Make sure to (1) get 93 the x64 variant if that's what you're targetting and (2) install the debug 94 library if you want to build a debug lldb. 95* `Python Tools for Visual Studio 96 <https://github.com/Microsoft/PTVS/releases>`_. If you plan to debug test 97 failures or even write new tests at all, PTVS is an indispensable debugging 98 extension to VS that enables full editing and debugging support for Python 99 (including mixed native/managed debugging). 100 101The steps outlined here describes how to set up your system and install the 102required dependencies such that they can be found when needed during the build 103process. They only need to be performed once. 104 105#. Install Visual Studio with the Windows SDK and ATL components. 106#. Install GnuWin32, making sure ``<GnuWin32 install dir>\bin`` is added to 107 your PATH environment variable. Verify that utilities like ``dirname`` and 108 ``make`` are available from your terminal. 109#. Install SWIG for Windows, making sure ``<SWIG install dir>`` is added to 110 your PATH environment variable. Verify that ``swig`` is available from your 111 terminal. 112#. Register the Debug Interface Access DLLs with the Registry from a privileged 113 terminal. 114 115:: 116 117> regsvr32 "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\DIA SDK\bin\msdia140.dll" 118> regsvr32 "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\DIA SDK\bin\amd64\msdia140.dll" 119 120Any command prompt from which you build LLDB should have a valid Visual Studio 121environment setup. This means you should run ``vcvarsall.bat`` or open an 122appropriate Visual Studio Command Prompt corresponding to the version you wish 123to use. 124 125macOS 126***** 127 128* To use the in-tree debug server on macOS, lldb needs to be code signed. For 129 more information see :ref:`CodeSigning` below. 130* If you are building both Clang and LLDB together, be sure to also check out 131 libc++, which is a required for testing on macOS. 132 133Building LLDB with CMake 134------------------------ 135 136The LLVM project is migrating to a single monolithic respository for LLVM and 137its subprojects. This is the recommended way to build LLDB. Check out the 138source-tree with git: 139 140:: 141 142 > git clone https://github.com/llvm/llvm-project.git 143 144CMake is a cross-platform build-generator tool. CMake does not build the 145project, it generates the files needed by your build tool. The recommended 146build tool for LLVM is Ninja, but other generators like Xcode or Visual Studio 147may be used as well. Please also read `Building LLVM with CMake 148<https://llvm.org/docs/CMake.html>`_. 149 150Regular in-tree builds 151********************** 152 153Create a new directory for your build-tree. From there run CMake and point it 154to the ``llvm`` directory in the source-tree: 155 156:: 157 158 > cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb" [<cmake options>] path/to/llvm-project/llvm 159 160We used the ``LLVM_ENABLE_PROJECTS`` option here to tell the build-system which 161subprojects to build in addition to LLVM (for more options see 162:ref:`CommonCMakeOptions` and :ref:`CMakeCaches`). Parts of the LLDB test suite 163require ``lld``. Add it to the list in order to run all tests. Once CMake is done, 164run ninja to perform the actual build. We pass ``lldb`` here as the target, so 165it only builds what is necessary to run the lldb driver: 166 167:: 168 169 > ninja lldb 170 171Standalone builds 172***************** 173 174This is another way to build LLDB. We can use the same source-tree as we 175checked out above, but now we will have multiple build-trees: 176 177* the main build-tree for LLDB in ``/path/to/lldb-build`` 178* one or more provided build-trees for LLVM and Clang; for simplicity we use a 179 single one in ``/path/to/llvm-build`` 180 181Run CMake with ``-B`` pointing to a new directory for the provided 182build-tree\ :sup:`1` and the positional argument pointing to the ``llvm`` 183directory in the source-tree. Note that we leave out LLDB here and only include 184Clang. Then we build the ``ALL`` target with ninja: 185 186:: 187 188 > cmake -B /path/to/llvm-build -G Ninja \ 189 -DLLVM_ENABLE_PROJECTS=clang \ 190 [<more cmake options>] /path/to/llvm-project/llvm 191 > ninja 192 193Now run CMake a second time with ``-B`` pointing to a new directory for the 194main build-tree and the positional argument pointing to the ``lldb`` directory 195in the source-tree. In order to find the provided build-tree, the build system 196looks for the path to its CMake modules in ``LLVM_DIR``. If you use a separate 197build directory for Clang, remember to pass its module path via ``Clang_DIR`` 198(CMake variables are case-sensitive!): 199 200:: 201 202 > cmake -B /path/to/lldb-build -G Ninja \ 203 -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \ 204 [<more cmake options>] /path/to/llvm-project/lldb 205 > ninja lldb 206 207.. note:: 208 209 #. The ``-B`` argument was undocumented for a while and is only officially 210 supported since `CMake version 3.14 211 <https://cmake.org/cmake/help/v3.14/release/3.14.html#command-line>`_ 212 213.. _CommonCMakeOptions: 214 215Common CMake options 216******************** 217 218Following is a description of some of the most important CMake variables which 219you are likely to encounter. A variable FOO is set by adding ``-DFOO=value`` to 220the CMake command line. 221 222If you want to debug the lldb that you're building -- that is, build it with 223debug info enabled -- pass two additional arguments to cmake before running 224ninja: 225 226:: 227 228 > cmake -G Ninja \ 229 -DLLDB_EXPORT_ALL_SYMBOLS=1 \ 230 -DCMAKE_BUILD_TYPE=Debug 231 <path to root of llvm source tree> 232 233If you want to run the test suite, you will need a compiler to build the test 234programs. If you have Clang checked out, that will be used by default. 235Alternatively, you can specify a C and C++ compiler to be used by the test 236suite. 237 238:: 239 240 > cmake -G Ninja \ 241 -DLLDB_TEST_COMPILER=<path to C compiler> \ 242 <path to root of llvm source tree> 243 244It is strongly recommend to use a release build for the compiler to speed up 245test execution. 246 247Windows 248^^^^^^^ 249 250On Windows the LLDB test suite requires lld. Either add ``lld`` to 251``LLVM_ENABLE_PROJECTS`` or disable the test suite with 252``LLDB_INCLUDE_TESTS=OFF``. 253 254Although the following CMake variables are by no means Windows specific, they 255are commonly used on Windows. 256 257* ``LLDB_TEST_DEBUG_TEST_CRASHES`` (Default=0): If set to 1, will cause Windows 258 to generate a crash dialog whenever lldb.exe or the python extension module 259 crashes while running the test suite. If set to 0, LLDB will silently crash. 260 Setting to 1 allows a developer to attach a JIT debugger at the time of a 261 crash, rather than having to reproduce a failure or use a crash dump. 262* ``PYTHON_HOME`` (Required): Path to the folder where the Python distribution 263 is installed. For example, ``C:\Python35``. 264* ``LLDB_RELOCATABLE_PYTHON`` (Default=0): When this is 0, LLDB will bind 265 statically to the location specified in the ``PYTHON_HOME`` CMake variable, 266 ignoring any value of ``PYTHONHOME`` set in the environment. This is most 267 useful for developers who simply want to run LLDB after they build it. If you 268 wish to move a build of LLDB to a different machine where Python will be in a 269 different location, setting ``LLDB_RELOCATABLE_PYTHON`` to 1 will cause 270 Python to use its default mechanism for finding the python installation at 271 runtime (looking for installed Pythons, or using the ``PYTHONHOME`` 272 environment variable if it is specified). 273 274Sample command line: 275 276:: 277 278 > cmake -G Ninja^ 279 -DLLDB_TEST_DEBUG_TEST_CRASHES=1^ 280 -DPYTHON_HOME=C:\Python35^ 281 -DLLDB_TEST_COMPILER=d:\src\llvmbuild\ninja_release\bin\clang.exe^ 282 <path to root of llvm source tree> 283 284 285Building with ninja is both faster and simpler than building with Visual Studio, 286but chances are you still want to debug LLDB with an IDE. One solution is to run 287cmake twice and generate the output into two different folders. One for 288compiling (the ninja folder), and one for editing, browsing and debugging. 289 290Follow the previous instructions in one directory, and generate a Visual Studio 291project in another directory. 292 293:: 294 295 > cmake -G "Visual Studio 15 2017 Win64" -Thost=x64 <cmake variables> <path to root of llvm source tree> 296 297Then you can open the .sln file in Visual Studio, set lldb as the startup 298project, and use F5 to run it. You need only edit the project settings to set 299the executable and the working directory to point to binaries inside of the 300ninja tree. 301 302 303macOS 304^^^^^ 305 306On macOS the LLDB test suite requires libc++. Either add ``libcxx`` to 307``LLVM_ENABLE_PROJECTS`` or disable the test suite with 308``LLDB_INCLUDE_TESTS=OFF``. Further useful options: 309 310* ``LLDB_BUILD_FRAMEWORK:BOOL``: Builds the LLDB.framework. 311* ``LLDB_CODESIGN_IDENTITY:STRING``: Set the identity to use for code-signing 312 all executables. If not explicitly specified, only ``debugserver`` will be 313 code-signed with identity ``lldb_codesign`` (see :ref:`CodeSigning`). 314* ``LLDB_USE_SYSTEM_DEBUGSERVER:BOOL``: Use the system's debugserver, so lldb is 315 functional without setting up code-signing. 316 317 318.. _CMakeCaches: 319 320CMake caches 321************ 322 323CMake caches allow to store common sets of configuration options in the form of 324CMake scripts and can be useful to reproduce builds for particular use-cases 325(see by analogy `usage in LLVM and Clang <https://llvm.org/docs/AdvancedBuilds.html>`_). 326A cache is passed to CMake with the ``-C`` flag, following the absolute path to 327the file on disk. Subsequent ``-D`` options are still allowed. Please find the 328currently available caches in the `lldb/cmake/caches/ 329<https://github.com/llvm/llvm-project/tree/master/lldb/cmake/caches>`_ 330directory. 331 332Common configurations on macOS 333^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 334 335Build, test and install a distribution of LLDB from the `monorepo 336<https://github.com/llvm/llvm-project>`_ (see also `Building a Distribution of 337LLVM <https://llvm.org/docs/BuildingADistribution.html>`_): 338 339:: 340 341 > git clone https://github.com/llvm/llvm-project 342 343 > cmake -B /path/to/lldb-build -G Ninja \ 344 -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake \ 345 -DLLVM_ENABLE_PROJECTS="clang;libcxx;lldb" \ 346 llvm-project/llvm 347 348 > DESTDIR=/path/to/lldb-install ninja -C /path/to/lldb-build check-lldb install-distribution 349 350.. _CMakeGeneratedXcodeProject: 351 352Build LLDB standalone for development with Xcode: 353 354:: 355 356 > git clone https://github.com/llvm/llvm-project 357 358 > cmake -B /path/to/llvm-build -G Ninja \ 359 -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-base.cmake \ 360 -DLLVM_ENABLE_PROJECTS="clang;libcxx" \ 361 llvm-project/llvm 362 > ninja -C /path/to/llvm-build 363 364 > cmake -B /path/to/lldb-build \ 365 -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \ 366 -DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \ 367 llvm-project/lldb 368 > open lldb.xcodeproj 369 > cmake --build /path/to/lldb-build --target check-lldb 370 371.. note:: 372 373 The ``-B`` argument was undocumented for a while and is only officially 374 supported since `CMake version 3.14 375 <https://cmake.org/cmake/help/v3.14/release/3.14.html#command-line>`_ 376 377 378Building the Documentation 379-------------------------- 380 381If you wish to build the optional (reference) documentation, additional 382dependencies are required: 383 384* Sphinx (for the website) 385* Graphviz (for the 'dot' tool) 386* doxygen (if you wish to build the C++ API reference) 387* epydoc (if you wish to build the Python API reference) 388 389To install the prerequisites for building the documentation (on Debian/Ubuntu) 390do: 391 392:: 393 394 > sudo apt-get install doxygen graphviz python3-sphinx 395 > sudo pip install epydoc 396 397To build the documentation, configure with ``LLVM_ENABLE_SPHINX=ON`` and build the desired target(s). 398 399:: 400 401 > ninja docs-lldb-html 402 > ninja docs-lldb-man 403 > ninja lldb-cpp-doc 404 > ninja lldb-python-doc 405 406Cross-compiling LLDB 407-------------------- 408 409In order to debug remote targets running different architectures than your 410host, you will need to compile LLDB (or at least the server component) for the 411target. While the easiest solution is to just compile it locally on the target, 412this is often not feasible, and in these cases you will need to cross-compile 413LLDB on your host. 414 415Cross-compilation is often a daunting task and has a lot of quirks which depend 416on the exact host and target architectures, so it is not possible to give a 417universal guide which will work on all platforms. However, here we try to 418provide an overview of the cross-compilation process along with the main things 419you should look out for. 420 421First, you will need a working toolchain which is capable of producing binaries 422for the target architecture. Since you already have a checkout of clang and 423lldb, you can compile a host version of clang in a separate folder and use 424that. Alternatively you can use system clang or even cross-gcc if your 425distribution provides such packages (e.g., ``g++-aarch64-linux-gnu`` on 426Ubuntu). 427 428Next, you will need a copy of the required target headers and libraries on your 429host. The libraries can be usually obtained by copying from the target machine, 430however the headers are often not found there, especially in case of embedded 431platforms. In this case, you will need to obtain them from another source, 432either a cross-package if one is available, or cross-compiling the respective 433library from source. Fortunately the list of LLDB dependencies is not big and 434if you are only interested in the server component, you can reduce this even 435further by passing the appropriate cmake options, such as: 436 437:: 438 439 -DLLDB_ENABLE_PYTHON=0 440 -DLLDB_ENABLE_LIBEDIT=0 441 -DLLDB_ENABLE_CURSES=0 442 -DLLVM_ENABLE_TERMINFO=0 443 444In this case you, will often not need anything other than the standard C and 445C++ libraries. 446 447Once all of the dependencies are in place, it's just a matter of configuring 448the build system with the locations and arguments of all the necessary tools. 449The most important cmake options here are: 450 451* ``CMAKE_CROSSCOMPILING`` : Set to 1 to enable cross-compilation. 452* ``CMAKE_LIBRARY_ARCHITECTURE`` : Affects the cmake search path when looking 453 for libraries. You may need to set this to your architecture triple if you do 454 not specify all your include and library paths explicitly. 455* ``CMAKE_C_COMPILER``, ``CMAKE_CXX_COMPILER`` : C and C++ compilers for the 456 target architecture 457* ``CMAKE_C_FLAGS``, ``CMAKE_CXX_FLAGS`` : The flags for the C and C++ target 458 compilers. You may need to specify the exact target cpu and abi besides the 459 include paths for the target headers. 460* ``CMAKE_EXE_LINKER_FLAGS`` : The flags to be passed to the linker. Usually 461 just a list of library search paths referencing the target libraries. 462* ``LLVM_TABLEGEN``, ``CLANG_TABLEGEN`` : Paths to llvm-tblgen and clang-tblgen 463 for the host architecture. If you already have built clang for the host, you 464 can point these variables to the executables in your build directory. If not, 465 you will need to build the llvm-tblgen and clang-tblgen host targets at 466 least. 467* ``LLVM_HOST_TRIPLE`` : The triple of the system that lldb (or lldb-server) 468 will run on. Not setting this (or setting it incorrectly) can cause a lot of 469 issues with remote debugging as a lot of the choices lldb makes depend on the 470 triple reported by the remote platform. 471 472You can of course also specify the usual cmake options like 473``CMAKE_BUILD_TYPE``, etc. 474 475Example 1: Cross-compiling for linux arm64 on Ubuntu host 476********************************************************* 477 478Ubuntu already provides the packages necessary to cross-compile LLDB for arm64. 479It is sufficient to install packages ``gcc-aarch64-linux-gnu``, 480``g++-aarch64-linux-gnu``, ``binutils-aarch64-linux-gnu``. Then it is possible 481to prepare the cmake build with the following parameters: 482 483:: 484 485 -DCMAKE_CROSSCOMPILING=1 \ 486 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ 487 -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ 488 -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-gnu \ 489 -DLLVM_TABLEGEN=<path-to-host>/bin/llvm-tblgen \ 490 -DCLANG_TABLEGEN=<path-to-host>/bin/clang-tblgen \ 491 -DLLDB_ENABLE_PYTHON=0 \ 492 -DLLDB_ENABLE_LIBEDIT=0 \ 493 -DLLDB_ENABLE_CURSES=0 494 495An alternative (and recommended) way to compile LLDB is with clang. 496Unfortunately, clang is not able to find all the include paths necessary for a 497successful cross-compile, so we need to help it with a couple of CFLAGS 498options. In my case it was sufficient to add the following arguments to 499``CMAKE_C_FLAGS`` and ``CMAKE_CXX_FLAGS`` (in addition to changing 500``CMAKE_C(XX)_COMPILER`` to point to clang compilers): 501 502:: 503 504 -target aarch64-linux-gnu \ 505 -I /usr/aarch64-linux-gnu/include/c++/4.8.2/aarch64-linux-gnu \ 506 -I /usr/aarch64-linux-gnu/include 507 508If you wanted to build a full version of LLDB and avoid passing 509``-DLLDB_ENABLE_PYTHON=0`` and other options, you would need to obtain the 510target versions of the respective libraries. The easiest way to achieve this is 511to use the qemu-debootstrap utility, which can prepare a system image using 512qemu and chroot to simulate the target environment. Then you can install the 513necessary packages in this environment (python-dev, libedit-dev, etc.) and 514point your compiler to use them using the correct -I and -L arguments. 515 516Example 2: Cross-compiling for Android on Linux 517*********************************************** 518 519In the case of Android, the toolchain and all required headers and libraries 520are available in the Android NDK. 521 522The NDK also contains a cmake toolchain file, which makes configuring the build 523much simpler. The compiler, include and library paths will be configured by the 524toolchain file and all you need to do is to select the architecture 525(ANDROID_ABI) and platform level (``ANDROID_PLATFORM``, should be at least 21). 526You will also need to set ``ANDROID_ALLOW_UNDEFINED_SYMBOLS=On``, as the 527toolchain file defaults to "no undefined symbols in shared libraries", which is 528not compatible with some llvm libraries. The first version of NDK which 529supports this approach is r14. 530 531For example, the following arguments are sufficient to configure an android 532arm64 build: 533 534:: 535 536 -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake \ 537 -DANDROID_ABI=arm64-v8a \ 538 -DANDROID_PLATFORM=android-21 \ 539 -DANDROID_ALLOW_UNDEFINED_SYMBOLS=On \ 540 -DLLVM_HOST_TRIPLE=aarch64-unknown-linux-android \ 541 -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DCMAKE_C_COMPILER=cc;-DCMAKE_CXX_COMPILER=c++' 542 543Note that currently only lldb-server is functional on android. The lldb client 544is not supported and unlikely to work. 545 546Verifying Python Support 547------------------------ 548 549LLDB has a Python scripting capability and supplies its own Python module named 550lldb. If a script is run inside the command line lldb application, the Python 551module is made available automatically. However, if a script is to be run by a 552Python interpreter outside the command line application, the ``PYTHONPATH`` 553environment variable can be used to let the Python interpreter find the lldb 554module. 555 556The correct path can be obtained by invoking the command line lldb tool with 557the -P flag: 558 559:: 560 561 > export PYTHONPATH=`$llvm/build/Debug+Asserts/bin/lldb -P` 562 563If you used a different build directory or made a release build, you may need 564to adjust the above to suit your needs. To test that the lldb Python module is 565built correctly and is available to the default Python interpreter, run: 566 567:: 568 569 > python -c 'import lldb' 570 571 572Make sure you're using the Python interpreter that matches the Python library 573you linked against. For more details please refer to the :ref:`caveats 574<python_caveat>`. 575 576.. _CodeSigning: 577 578Code Signing on macOS 579--------------------- 580 581To use the in-tree debug server on macOS, lldb needs to be code signed. The 582Debug, DebugClang and Release builds are set to code sign using a code signing 583certificate named ``lldb_codesign``. 584 585Automatic setup, run: 586 587* ``scripts/macos-setup-codesign.sh`` 588 589Note that it's possible to build and use lldb on macOS without setting up code 590signing by using the system's debug server. To configure lldb in this way with 591cmake, specify ``-DLLDB_USE_SYSTEM_DEBUGSERVER=ON``. 592 593If you have re-installed a new OS, please delete all old ``lldb_codesign`` items 594from your keychain. There will be a code signing certification and a public 595and private key. Reboot after deleting them. You will also need to delete and 596build folders that contained old signed items. The darwin kernel will cache 597code signing using the executable's file system node, so you will need to 598delete the file so the kernel clears its cache. 599 600When you build your LLDB for the first time, the Xcode GUI will prompt you for 601permission to use the ``lldb_codesign`` keychain. Be sure to click "Always 602Allow" on your first build. From here on out, the ``lldb_codesign`` will be 603trusted and you can build from the command line without having to authorize. 604Also the first time you debug using a LLDB that was built with this code 605signing certificate, you will need to authenticate once. 606