Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| 2 | <html xmlns="http://www.w3.org/1999/xhtml">
|
| 3 | <head>
|
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
| 5 | <link href="style.css" rel="stylesheet" type="text/css" />
|
Greg Clayton | f9ab5ea | 2012-01-22 02:55:08 +0000 | [diff] [blame] | 6 | <title>Building LLDB</title>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 7 | </head>
|
| 8 |
|
| 9 | <body>
|
| 10 | <div class="www_title">
|
| 11 | The <strong>LLDB</strong> Debugger
|
| 12 | </div>
|
| 13 |
|
| 14 | <div id="container">
|
| 15 | <div id="content">
|
| 16 |
|
| 17 | <!--#include virtual="sidebar.incl"-->
|
| 18 |
|
| 19 | <div id="middle">
|
Daniel Malea | 6569003 | 2013-02-26 21:41:55 +0000 | [diff] [blame] | 20 | <h1 class ="postheader">Continuous Integraton</h1>
|
| 21 | <div class="postcontent">
|
| 22 | <p> The following LLVM buildbots build and test LLDB trunk:
|
| 23 | <ul>
|
| 24 | <li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-debian-clang">LLDB Linux x86_64 build with Clang (automake)</a>
|
| 25 | <li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-linux">LLDB Linux x86_64 build with GCC 4.6 (automake)</a>
|
| 26 | <li> <a href="http://lab.llvm.org:8011/builders/lldb-x86_64-darwin11">LLDB Mac OS X x86_64 build with Clang (XCode)</a>
|
Ed Maste | b669abf | 2013-07-24 14:44:09 +0000 | [diff] [blame] | 27 | <li> <a href="http://llvm-amd64.freebsd.your.org:8010/builders/lldb-amd64-freebsd">LLDB FreeBSD x86_64</a>
|
| 28 | <li> <a href="http://llvm-amd64.freebsd.your.org:8010/builders/lldb-i386-freebsd">LLDB FreeBSD i386</a>
|
Daniel Malea | 6569003 | 2013-02-26 21:41:55 +0000 | [diff] [blame] | 29 | </ul>
|
| 30 | </div>
|
| 31 | <div class="postfooter"></div>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 32 | <div class="post">
|
| 33 | <h1 class ="postheader">Building LLDB on Mac OS X</h1>
|
| 34 | <div class="postcontent">
|
| 35 | <p>Building on Mac OS X is as easy as downloading the code and building the Xcode project or workspace:</p>
|
Johnny Chen | e4ec509 | 2012-08-16 00:08:21 +0000 | [diff] [blame] | 36 | </div>
|
| 37 | <div class="postcontent">
|
| 38 | <h2>Preliminaries</h2>
|
| 39 | <ul>
|
| 40 | <li>XCode 4.3 or newer requires the "Command Line Tools" component (XCode->Preferences->Downloads->Components).</li>
|
| 41 | <li>Mac OS X Lion or newer requires installing <a href="http://swig.org">Swig</a>.</li>
|
| 42 | </ul>
|
| 43 | <h2>Building LLDB</h2>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 44 | <ul>
|
| 45 | <li><a href="download.html">Download</a> the lldb sources.</li>
|
| 46 | <li>Follow the code signing instructions in <b>lldb/docs/code-signing.txt</b></li>
|
| 47 | <li>In Xcode 3.x: <b>lldb/lldb.xcodeproj</b>, select the <b>lldb-tool</b> target, and build.</li>
|
| 48 | <li>In Xcode 4.x: <b>lldb/lldb.xcworkspace</b>, select the <b>lldb-tool</b> scheme, and build.</li>
|
| 49 | </ul>
|
| 50 | </div>
|
| 51 | <div class="postfooter"></div>
|
| 52 | </div>
|
| 53 | <div class="post">
|
Ed Maste | d6b0910 | 2013-07-24 14:53:48 +0000 | [diff] [blame] | 54 | <h1 class ="postheader">Building LLDB on Linux and FreeBSD</h1>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 55 | <div class="postcontent">
|
Ed Maste | d6b0910 | 2013-07-24 14:53:48 +0000 | [diff] [blame] | 56 | <p>This document describes the steps needed to compile LLDB on most Linux systems, and FreeBSD.</a></p>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 57 | </div>
|
| 58 | <div class="postcontent">
|
| 59 | <h2>Preliminaries</h2>
|
| 60 | <p>LLDB relies on many of the technologies developed by the larger LLVM project.
|
| 61 | In particular, it requires both Clang and LLVM itself in order to build. Due to
|
| 62 | this tight integration the <em>Getting Started</em> guides for both of these projects
|
| 63 | come as prerequisite reading:</p>
|
| 64 | <ul>
|
| 65 | <li><a href="http://llvm.org/docs/GettingStarted.html">LLVM</a></li>
|
| 66 | <li><a href="http://clang.llvm.org/get_started.html">Clang</a></li>
|
| 67 | </ul>
|
Daniel Malea | 284e43e | 2012-12-14 20:02:21 +0000 | [diff] [blame] | 68 | <p>Supported compilers for building LLDB on Linux include:</p>
|
| 69 | <ul>
|
| 70 | <li>Clang 3.2</li>
|
| 71 | <li><a href="http://gcc.gnu.org">GCC</a> 4.6.2 (later versions should work as well)</li>
|
| 72 | </ul>
|
| 73 | <p>It is recommended to use libstdc++ 4.6 (or higher) to build LLDB on Linux, but using libc++ is also known to work.</p>
|
Ed Maste | d6b0910 | 2013-07-24 14:53:48 +0000 | [diff] [blame] | 74 | <p>On FreeBSD the base system Clang and libc++ may be used to build LLDB,
|
| 75 | or the GCC port or package.</p>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 76 | <p>In addition to any dependencies required by LLVM and Clang, LLDB needs a few
|
| 77 | development packages that may also need to be installed depending on your
|
| 78 | system. The current list of dependencies are:</p>
|
| 79 | <ul>
|
| 80 | <li><a href="http://swig.org">Swig</a></li>
|
Ed Maste | d6b0910 | 2013-07-24 14:53:48 +0000 | [diff] [blame] | 81 | <li><a href="http://www.thrysoee.dk/editline">libedit</a> (Linux only)</li>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 82 | <li><a href="http://www.python.org">Python</a></li>
|
| 83 | </ul>
|
Greg Clayton | f19e199 | 2012-10-15 20:39:39 +0000 | [diff] [blame] | 84 | <p>So for example, on a Fedora system one might run:</p>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 85 | <code>> yum install swig python-devel libedit-devel</code>
|
Greg Clayton | f19e199 | 2012-10-15 20:39:39 +0000 | [diff] [blame] | 86 | <p>On an Ubuntu system one might run:</p>
|
Greg Clayton | 65da8c2 | 2013-05-03 16:29:42 +0000 | [diff] [blame] | 87 | <code>> sudo apt-get install build-essential subversion swig python-dev libedit-dev </code>
|
Ed Maste | d6b0910 | 2013-07-24 14:53:48 +0000 | [diff] [blame] | 88 | <p>On FreeBSD one might run:</p>
|
| 89 | <code>> pkg install swig python</code>
|
Daniel Malea | 56c7ef6 | 2013-05-28 03:47:34 +0000 | [diff] [blame] | 90 | <p>If you wish to build the optional reference documentation, additional dependencies are required:</p>
|
| 91 | <ul>
|
| 92 | <li> Graphviz (for the 'dot' tool).
|
| 93 | <li> doxygen (only if you wish to build the C++ API reference)
|
| 94 | <li> epydoc (only if you wish to build the Python API reference)
|
| 95 | </ul>
|
| 96 | <p>To install the prerequisites for building the documentation (on Ubuntu) do:</p>
|
| 97 | <code>
|
| 98 | <br>> sudo apt-get install doxygen graphviz
|
| 99 | <br>> sudo pip install epydoc
|
| 100 | </code>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 101 | <h2 >Building LLDB</h2>
|
| 102 | <p>We first need to checkout the source trees into the appropriate locations. Both
|
| 103 | Clang and LLDB build as subprojects of LLVM. This means we will be checking out
|
| 104 | the source for both Clang and LLDB into the <tt>tools</tt> subdirectory of LLVM. We
|
| 105 | will be setting up a directory hierarchy looking something like this:</p>
|
| 106 | <p>
|
| 107 | <pre><tt>
|
| 108 | llvm
|
| 109 | |
|
| 110 | `-- tools
|
| 111 | |
|
| 112 | +-- clang
|
| 113 | |
|
| 114 | `-- lldb
|
| 115 | </tt></pre>
|
| 116 | </p>
|
| 117 | <p>For reference, we will call the root of the LLVM project tree <tt>$llvm</tt>, and the
|
| 118 | roots of the Clang and LLDB source trees <tt>$clang</tt> and <tt>$lldb</tt> respectively.</p>
|
| 119 | <p>Change to the directory where you want to do development work and checkout LLVM:</p>
|
| 120 | <code>> svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</code>
|
| 121 |
|
| 122 | <p>Now switch to LLVM’s tools subdirectory and checkout both Clang and LLDB:</p>
|
| 123 | <code>> cd $llvm/tools
|
| 124 | <br>> svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
|
| 125 | <br>> svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
|
| 126 | </code>
|
| 127 |
|
Greg Clayton | f19e199 | 2012-10-15 20:39:39 +0000 | [diff] [blame] | 128 | <p>In general, building the LLDB trunk revision requires trunk revisions of both
|
| 129 | LLVM and Clang.
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 130 | <p>It is highly recommended that you build the system out of tree. Create a second
|
| 131 | build directory and configure the LLVM project tree to your specifications as
|
Greg Clayton | f19e199 | 2012-10-15 20:39:39 +0000 | [diff] [blame] | 132 | outlined in LLVM’s <em>Getting Started Guide</em>. A typical build procedure
|
| 133 | might be:</p>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 134 | <code>> cd $llvm/..
|
| 135 | <br>> mkdir build
|
| 136 | <br>> cd build
|
Daniel Malea | 284e43e | 2012-12-14 20:02:21 +0000 | [diff] [blame] | 137 | </code>
|
Daniel Malea | 02c106f | 2013-03-05 22:38:50 +0000 | [diff] [blame] | 138 | <h2>To build with CMake</h2>
|
| 139 | <p>Using CMake is documented on the <a href="http://llvm.org/docs/CMake.html">Building LLVM with CMake</a>
|
| 140 | page. Building LLDB is possible using one of the following generators:
|
| 141 | </p>
|
| 142 | <ul>
|
| 143 | <li> Ninja </li>
|
| 144 | <li> Unix Makefiles </li>
|
| 145 | </ul>
|
| 146 | <h3>Using CMake + Ninja</h3>
|
| 147 | <p>Ninja is the fastest way to build LLDB! In order to use ninja, you need to have recent versions of CMake and
|
| 148 | ninja on your system. To build using ninja:
|
| 149 | </p>
|
| 150 | <code>
|
Stefanus Du Toit | 69a3951 | 2013-07-23 17:29:44 +0000 | [diff] [blame] | 151 | > cmake .. -G Ninja
|
Daniel Malea | 02c106f | 2013-03-05 22:38:50 +0000 | [diff] [blame] | 152 | <br>> ninja lldb
|
| 153 | <br>> ninja check-lldb
|
| 154 | </code>
|
| 155 | <h3>Using CMake + Unix Makefiles</h3>
|
Daniel Malea | 66fd7b1 | 2013-03-05 22:43:08 +0000 | [diff] [blame] | 156 | <p>If you do not have Ninja, you can still use CMake to generate Unix Makefiles that build LLDB:</p>
|
Daniel Malea | 02c106f | 2013-03-05 22:38:50 +0000 | [diff] [blame] | 157 | <code>
|
Stefanus Du Toit | 69a3951 | 2013-07-23 17:29:44 +0000 | [diff] [blame] | 158 | > cmake ..
|
Daniel Malea | 51a5b47 | 2013-04-02 20:08:19 +0000 | [diff] [blame] | 159 | <br>> make
|
Daniel Malea | 02c106f | 2013-03-05 22:38:50 +0000 | [diff] [blame] | 160 | <br>> make check-lldb
|
| 161 | </code>
|
Daniel Malea | 66fd7b1 | 2013-03-05 22:43:08 +0000 | [diff] [blame] | 162 | <h2>To build with autoconf</h2>
|
Daniel Malea | d284d1b | 2013-03-05 22:58:53 +0000 | [diff] [blame] | 163 | <p>If you do not have CMake, it is still possible to build LLDB using the autoconf build system. If you are using
|
| 164 | Clang or GCC 4.7+, run:</p>
|
Daniel Malea | 284e43e | 2012-12-14 20:02:21 +0000 | [diff] [blame] | 165 | <code>
|
Greg Clayton | 7712e1c | 2013-05-17 21:06:45 +0000 | [diff] [blame] | 166 | > $llvm/configure --enable-cxx11
|
Daniel Malea | a56f7f0 | 2012-11-10 18:09:36 +0000 | [diff] [blame] | 167 | <br>> make </code>
|
Daniel Malea | d284d1b | 2013-03-05 22:58:53 +0000 | [diff] [blame] | 168 | <p>Or, if you are using a version of GCC that does not support the <tt>-std=c++11</tt> option:</p>
|
Daniel Malea | 284e43e | 2012-12-14 20:02:21 +0000 | [diff] [blame] | 169 | <code>
|
Greg Clayton | 7712e1c | 2013-05-17 21:06:45 +0000 | [diff] [blame] | 170 | > $llvm/configure
|
Daniel Malea | 284e43e | 2012-12-14 20:02:21 +0000 | [diff] [blame] | 171 | <br>> make CXXFLAGS=-std=c++0x</code>
|
Greg Clayton | 7712e1c | 2013-05-17 21:06:45 +0000 | [diff] [blame] | 172 | <p>If you are building with a GCC that isn't the default gcc/g++, like gcc-4.7/g++-4.7</p>
|
| 173 | <code>
|
| 174 | > $llvm/configure --enable-cxx11 CC=gcc-4.7 CXX=g++-4.7
|
| 175 | <br>> make CC=gcc-4.7 CXX=g++-4.7</code>
|
| 176 | <p>If you are running in a system that doesn't have a lot of RAM (less than 4GB), you might want to disable
|
| 177 | debug symbols by specifying DEBUG_SYMBOLS=0 when running make. You will know if you need to enable this
|
| 178 | because you will fail to link clang (the linker will get a SIGKILL and exit with status 9).</p>
|
| 179 | <code>
|
| 180 | > make DEBUG_SYMBOLS=0</code>
|
Daniel Malea | d284d1b | 2013-03-05 22:58:53 +0000 | [diff] [blame] | 181 | <p> To run the LLDB test suite, run:</p>
|
| 182 | <code>
|
| 183 | <br>> make -C tools/lldb/test</code>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 184 | <p>Note that once both LLVM and Clang have been configured and built it is not
|
| 185 | necessary to perform a top-level <tt>make</tt> to rebuild changes made only to LLDB.
|
Daniel Malea | 1866b87 | 2012-12-17 21:32:49 +0000 | [diff] [blame] | 186 | You can run <tt>make</tt> from the <tt>build/tools/lldb</tt> subdirectory as well.</p>
|
Daniel Malea | d284d1b | 2013-03-05 22:58:53 +0000 | [diff] [blame] | 187 | <p> If you wish to build with libc++ instead of libstdc++ (the default), run configure with the
|
Daniel Malea | 1866b87 | 2012-12-17 21:32:49 +0000 | [diff] [blame] | 188 | <tt>--enable-libcpp</tt> flag.</p>
|
| 189 | <p> If you wish to build a release version of LLDB, run configure with the <tt>--enable-optimized</tt> flag.</p>
|
Daniel Malea | 02c106f | 2013-03-05 22:38:50 +0000 | [diff] [blame] | 190 |
|
Daniel Malea | 4f1759b | 2013-05-17 16:08:45 +0000 | [diff] [blame] | 191 | <h2>Testing</h2>
|
Daniel Malea | 6d66236 | 2013-05-28 19:14:44 +0000 | [diff] [blame] | 192 | <p>By default, the <tt>check-lldb</tt> target builds the 64-bit variants of the test programs with the same
|
| 193 | compiler that was used to build LLDB. It is possible to customize the architecture and compiler by appending -A and
|
| 194 | -C options respectively to the CMake variable <tt>LLDB_TEST_ARGS</tt>. For example, to test LLDB against 32-bit binaries
|
| 195 | built with a custom version of clang, do:</p>
|
| 196 | <code>
|
| 197 | <br>> cmake -DLLDB_TEST_ARGS="-A i386 -C /path/to/custom/clang" -G Ninja
|
| 198 | <br>> ninja check-lldb
|
| 199 | </code>
|
| 200 | <p>Note that multiple -A and -C flags can be specified to <tt>LLDB_TEST_ARGS</tt>.</p>
|
Daniel Malea | 4f1759b | 2013-05-17 16:08:45 +0000 | [diff] [blame] | 201 | <p>In addition to running all the LLDB test suites with the "check-lldb" CMake target above, it is possible to
|
| 202 | run individual LLDB tests. For example, to run the test cases defined in TestInferiorCrashing.py, run:</p>
|
| 203 | <code>
|
| 204 | <br>> cd $lldb/test
|
| 205 | <br>> python dotest.py --executable <path-to-lldb> -p TestInferiorCrashing.py
|
| 206 | </code>
|
| 207 | <p>In addition to running a test by name, it is also possible to specify a directory path to <tt>dotest.py</tt>
|
| 208 | in order to run all the tests under that directory. For example, to run all the tests under the
|
| 209 | 'functionalities/data-formatter' directory, run:</p>
|
| 210 | <code>
|
| 211 | <br>> python dotest.py --executable <path-to-lldb> functionalities/data-formatter
|
| 212 | </code>
|
| 213 | <p>To dump additional information to <tt>stdout</tt> about how the test harness is driving LLDB, run
|
| 214 | <tt>dotest.py</tt> with the <tt>-t</tt> flag. Many more options that are available. To see a list of all of them, run:</p>
|
| 215 | <code>
|
| 216 | <br>> python dotest.py -h
|
| 217 | </code>
|
Daniel Malea | 56c7ef6 | 2013-05-28 03:47:34 +0000 | [diff] [blame] | 218 | <h2>Building API reference documentation</h2>
|
| 219 | <p>LLDB exposes a C++ as well as a Python API. To build the reference documentation for these two APIs, ensure you have
|
| 220 | the required dependencies installed, and build the <tt>lldb-python-doc</tt> and <tt>lldb-cpp-doc</tt> CMake targets.</p>
|
| 221 | <p> The output HTML reference documentation can be found in <tt><build-dir>/tools/lldb/docs/</tt>.<p>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 222 | <h2>Additional Notes</h2>
|
Daniel Malea | 5a39ce3 | 2013-01-05 00:16:08 +0000 | [diff] [blame] | 223 | <p>LLDB has a Python scripting capability and supplies its own Python module named <tt>lldb</tt>.
|
| 224 | If a script is run inside the command line <tt>lldb</tt> application, the Python module
|
| 225 | is made available automatically. However, if a script is to be run by a Python interpreter
|
| 226 | outside the command line application, the <tt>PYTHONPATH</tt> environment variable can be used
|
| 227 | to let the Python interpreter find the <tt>lldb</tt> module.
|
| 228 | <p>The correct path can be obtained by invoking the command line <tt>lldb</tt> tool with the -P flag:</p>
|
| 229 | <code>> export PYTHONPATH=`$llvm/build/Debug+Asserts/bin/lldb -P`</code>
|
| 230 | <p>If you used a different build directory or made a release build, you may need to adjust the
|
| 231 | above to suit your needs. To test that the lldb Python module
|
| 232 | is built correctly and is available to the default Python interpreter, run:</p>
|
Greg Clayton | f19e199 | 2012-10-15 20:39:39 +0000 | [diff] [blame] | 233 | <code>> python -c 'import lldb'</code></p>
|
Greg Clayton | 41d8a5c | 2011-03-22 22:39:26 +0000 | [diff] [blame] | 234 | </div>
|
| 235 | <div class="postfooter"></div>
|
| 236 | </div>
|
| 237 | </div>
|
| 238 | </div>
|
| 239 | </div>
|
| 240 | </body>
|
Greg Clayton | f19e199 | 2012-10-15 20:39:39 +0000 | [diff] [blame] | 241 | </html>
|