Building LLDB on Mac OS X

In Xcode 3.x: lldb/lldb.xcodeproj, select the lldb-tool target, and build.

In Xcode 4.x: lldb/lldb.xcworkspace, select the lldb-tool scheme, and build.

Building LLDB on Linux

This document describes the steps needed to compile LLDB on most Linux systems.

Preliminaries

LLDB relies on many of the technologies developed by the larger LLVM project.
In particular, it requires both Clang and LLVM itself in order to build. Due to
this tight integration the Getting Started guides for both of these projects
come as prerequisite reading:

Building LLDB

We first need to checkout the source trees into the appropriate locations. Both
Clang and LLDB build as subprojects of LLVM. This means we will be checking out
the source for both Clang and LLDB into the tools subdirectory of LLVM. We
will be setting up a directory hierarchy looking something like this:

llvm
|
`-- tools
|
+-- clang
|
`-- lldb

For reference, we will call the root of the LLVM project tree $llvm, and the
roots of the Clang and LLDB source trees $clang and $lldb respectively.

Change to the directory where you want to do development work and checkout LLVM:

> svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm

Now switch to LLVM’s tools subdirectory and checkout both Clang and LLDB:

In general, LLDB requires specific revisions of both LLVM and Clang in order to
build. This requirement insulates LLDB a bit from the constant development
happening in both of these projects. The required revision can be discovered by
consulting the Perl script $lldb/scripts/build-llvm.pl and locating the
$llvm_revision variable. At the time of this writing, the required revision
is r127682, so we might check and revert our LLVM and Clang trees to the
required state as follows:

It is highly recommended that you build the system out of tree. Create a second
build directory and configure the LLVM project tree to your specifications as
outlined in LLVM’s Getting Started Guide. For Linux development the x86
backend and JIT compiler should be enabled. A typical build procedure might be:

Note that once both LLVM and Clang have been configured and built it is not
necessary to perform a top-level make to rebuild changes made only to LLDB.
You can build from the build/tools/lldb subdirectory as well.

Additional Notes

LLDB has a Python scripting capability and supplies it’s own Python module,
lldb.py, built alongside the lldb binary. Python needs to know where to
look for this module when LLDB starts up. There are two options available:

Keep a copy of lldb.py in the current working directory when starting lldb.