[lldb-dev] Notes for building LLDB on Linux
Stephen Wilson
wilsons at start.ca
Tue Mar 22 12:20:17 PDT 2011
*,
I wrote up a quick set of notes on how to build LLDB on Linux.
A few weeks ago LLVM grew the makefile support needed to build LLDB as a
proper subproject. IOW, you can check out the Clang and LLDB sources
into the LLVM "tools" subdirectory, configure, and do a top-level 'make'
to build the complete system. The attached doc gives a quick overview
of the procedure.
Currently all of LLDB's documentation (that exists in the doc
subdirectory anyway) is plain text. I decided to stick with that basic
convention but to format the text so it can be parsed by the asciidoc
tool (http://www.methods.co.nz/asciidoc/index.html). This is a nice
little utility that turns very plain and readable text into very plain
and readable web pages. I attached the html output as well if anyone is
interested in having a look.
Any comments on the notes or the asciidoc approach most appreciated!
--
steve
-------------- next part --------------
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:
LLVM::
http://llvm.org/docs/GettingStarted.html
Clang::
http://clang.llvm.org/get_started.html
In addition to any dependencies required by LLVM and Clang, LLDB needs a few
development packages that may also need to be installed depending on your
system. The current list of dependencies are:
Swig::
http://swig.org
libedit::
http://www.thrysoee.dk/editline
Python::
http://www.python.org
So for example, on a Fedora system one might say:
---------------------------------------------------------------
> yum install swig python-devel libedit-devel
---------------------------------------------------------------
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:
---------------------------------------------------------------
> cd $llvm/tools
> svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
> svn co http://llvm.org/svn/llvm-project/lldb/trunk 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:
---------------------------------------------------------------
> grep -m 1 llvm_revision $lldb/scripts/build-llvm.pl
our $llvm_revision = "127682";
> cd $clang
> svn update -r 127682
> cd $llvm
> svn update -r 127682
---------------------------------------------------------------
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:
---------------------------------------------------------------
> cd $llvm/..
> mkdir build
> cd build
> $llvm/configure --enable-targets=x86 --enable-jit
> make
---------------------------------------------------------------
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:
1. Keep a copy of `lldb.py` in the current working directory when starting
lldb.
2. Set `PYTHONPATH` to point to the directory holding `lldb.py`.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20110322/e82249cb/attachment.html>
More information about the lldb-dev
mailing list