build.html   [plain text]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
<title>LLDB FAQ</title>

    <div class="www_title">
      The <strong>LLDB</strong> Debugger
<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>
                        <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>
              	<div class="postfooter"></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 class="postcontent">
                <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>
                    <li><a href="">LLVM</a></li>
                    <li><a href="">Clang</a></li>
                <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>
                    <li><a href="">Swig</a></li>
                    <li><a href="">libedit</a></li>
                    <li><a href="">Python</a></li>
                <p>So for example, on a Fedora system one might say:</p>
                <code>&gt; yum install swig python-devel libedit-devel</code>
                <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>
                  `-- tools
                      +-- clang
                      `-- lldb
                <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>&gt; svn co llvm</code>
                <p>Now switch to LLVM&#8217;s tools subdirectory and checkout both Clang and LLDB:</p>
                <code>&gt; cd $llvm/tools
                <br>&gt; svn co clang
                <br>&gt; svn co lldb
                <p>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 <tt>$lldb/scripts/</tt> and locating the
                <tt>$llvm_revision</tt> variable.  At the time of this writing, the required revision
                is <tt>r127682</tt>, so we might check and revert our LLVM and Clang trees to the
                required state as follows:</p>
                <code>&gt; grep -m 1 llvm_revision $lldb/scripts/
                  <br>our $llvm_revision = "127682";
                  <br>&gt; cd $clang
                  <br>&gt; svn update -r 127682
                  <br>&gt; cd $llvm
                  <br>&gt; svn update -r 127682</code>
                <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&#8217;s <em>Getting Started Guide</em>.  For Linux development the x86
                backend and JIT compiler should be enabled.  A typical build procedure might be:</p>
                <code>&gt; cd $llvm/..
                  <br>&gt; mkdir build
                  <br>&gt; cd build
                  <br>&gt; $llvm/configure --enable-targets=x86 --enable-jit
                  <br>&gt; 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 build from the <tt>build/tools/lldb</tt> subdirectory as well.</p>
                <h2>Additional Notes</h2>
                <p>LLDB has a Python scripting capability and supplies it&#8217;s own Python module,
                <tt></tt>, built alongside the <tt>lldb</tt> binary.  Python needs to know where to
                look for this module when LLDB starts up.  There are two options available:</p>
                <ol class="arabic">
                    <p>Keep a copy of <tt></tt> in the current working directory when starting lldb.</p>
                    <p>Set <tt>PYTHONPATH</tt> to point to the directory holding <tt></tt>.</p>
              	<div class="postfooter"></div>