<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | |
<link href="style.css" rel="stylesheet" type="text/css" /> | |
<title>Building LLDB</title> | |
</head> | |
<body> | |
<div class="www_title"> | |
The <strong>LLDB</strong> Debugger | |
</div> | |
<div id="container"> | |
<div id="content"> | |
<!--#include virtual="sidebar.incl"--> | |
<div id="middle"> | |
<div class="post"> | |
<h1 class ="postheader">Building LLDB on Mac OS X</h1> | |
<div class="postcontent"> | |
<p>Building on Mac OS X is as easy as downloading the code and building the Xcode project or workspace:</p> | |
</div> | |
<div class="postcontent"> | |
<h2>Preliminaries</h2> | |
<ul> | |
<li>XCode 4.3 or newer requires the "Command Line Tools" component (XCode->Preferences->Downloads->Components).</li> | |
<li>Mac OS X Lion or newer requires installing <a href="http://swig.org">Swig</a>.</li> | |
</ul> | |
<h2>Building LLDB</h2> | |
<ul> | |
<li><a href="download.html">Download</a> the lldb sources.</li> | |
<li>Follow the code signing instructions in <b>lldb/docs/code-signing.txt</b></li> | |
<li>In Xcode 3.x: <b>lldb/lldb.xcodeproj</b>, select the <b>lldb-tool</b> target, and build.</li> | |
<li>In Xcode 4.x: <b>lldb/lldb.xcworkspace</b>, select the <b>lldb-tool</b> scheme, and build.</li> | |
</ul> | |
</div> | |
<div class="postfooter"></div> | |
</div> | |
<div class="post"> | |
<h1 class ="postheader">Building LLDB on Linux</h1> | |
<div class="postcontent"> | |
<p>This document describes the steps needed to compile LLDB on most Linux systems.</a></p> | |
</div> | |
<div class="postcontent"> | |
<h2>Preliminaries</h2> | |
<p>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 <em>Getting Started</em> guides for both of these projects | |
come as prerequisite reading:</p> | |
<ul> | |
<li><a href="http://llvm.org/docs/GettingStarted.html">LLVM</a></li> | |
<li><a href="http://clang.llvm.org/get_started.html">Clang</a></li> | |
</ul> | |
<p>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:</p> | |
<ul> | |
<li><a href="http://swig.org">Swig</a></li> | |
<li><a href="http://www.thrysoee.dk/editline">libedit</a></li> | |
<li><a href="http://www.python.org">Python</a></li> | |
</ul> | |
<p>So for example, on a Fedora system one might run:</p> | |
<code>> yum install swig python-devel libedit-devel</code> | |
<p>On an Ubuntu system one might run:</p> | |
<code>> sudo apt-get install swig python-dev libedit-dev </code> | |
<p>If building using GCC instead of Clang, GCC 4.6.2 or newer is required.</p> | |
<ul> | |
<li><a href="http://gcc.gnu.org">GCC</a></li> | |
</ul> | |
<h2 >Building LLDB</h2> | |
<p>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 <tt>tools</tt> subdirectory of LLVM. We | |
will be setting up a directory hierarchy looking something like this:</p> | |
<p> | |
<pre><tt> | |
llvm | |
| | |
`-- tools | |
| | |
+-- clang | |
| | |
`-- lldb | |
</tt></pre> | |
</p> | |
<p>For reference, we will call the root of the LLVM project tree <tt>$llvm</tt>, and the | |
roots of the Clang and LLDB source trees <tt>$clang</tt> and <tt>$lldb</tt> respectively.</p> | |
<p>Change to the directory where you want to do development work and checkout LLVM:</p> | |
<code>> svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</code> | |
<p>Now switch to LLVM’s tools subdirectory and checkout both Clang and LLDB:</p> | |
<code>> cd $llvm/tools | |
<br>> svn co http://llvm.org/svn/llvm-project/cfe/trunk clang | |
<br>> svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb | |
</code> | |
<p>In general, building the LLDB trunk revision requires trunk revisions of both | |
LLVM and Clang. | |
<p>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 <em>Getting Started Guide</em>. A typical build procedure | |
might be:</p> | |
<code>> cd $llvm/.. | |
<br>> mkdir build | |
<br>> cd build | |
<br>> $llvm/configure --enable-cxx11 --enable-libcpp | |
<br>> make </code> | |
<p>Note that once both LLVM and Clang have been configured and built it is not | |
necessary to perform a top-level <tt>make</tt> to rebuild changes made only to LLDB. | |
You can run <tt>make</tt> from the <tt>build/tools/lldb</tt> subdirectory as well. If your | |
compiler doesn't support libc++, you may need to tweak or remove the last | |
parameter to the configure script.</p> | |
<h2>Additional Notes</h2> | |
<p>LLDB has a Python scripting capability and supplies its own Python module, | |
<tt>lldb</tt>, built alongside the <tt>lldb</tt> binary. Python needs to know where to | |
look for this module when LLDB starts up. To tell python the location of LLDB, set | |
<tt>PYTHONPATH</tt> environment variable. | |
<p>In bash with a <tt>Debug+Asserts</tt> build (the default if configure is invoked | |
like in the example on this page) one might run:</p> | |
<code>> export PYTHONPATH=$llvm/build/Debug+Asserts/lib/python2.7/site-packages</code> | |
<p>If you used different configure flags, or have a different version of python, | |
you may need to adjust the above to suit your needs. To test that the lldb python module | |
is built correctly and is available to Python, run:</p> | |
<code>> python -c 'import lldb'</code></p> | |
</div> | |
<div class="postfooter"></div> | |
</div> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |