blob: 75cfd1905a1bc1f1dd1fae9c1eaf0f880acc1226 [file] [log] [blame]
Michael J. Spencer365f1ec2012-04-25 19:34:24 +00001.. _getting_started:
2
3Getting Started: Building and Running lld
4=========================================
5
6This page gives you the shortest path to checking out and building lld. If you
7run into problems, please file bugs in the `LLVM Bugzilla`__
8
9__ http://llvm.org/bugs/
10
11Building lld
12------------
13
14On Unix-like Systems
15~~~~~~~~~~~~~~~~~~~~
16
Nick Kledzikf7848172012-04-26 23:41:01 +0000171. Get the required tools.
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000018
19 * `CMake 2.8`_\+.
20 * make (or any build system CMake supports).
21 * `Clang 3.1`_\+ or GCC 4.7+ (C++11 support is required).
22
23 * If using Clang, you will also need `libc++`_.
24 * `Python 2.4`_\+ (not 3.x) for running tests.
25
26.. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html
27.. _Clang 3.1: http://clang.llvm.org/
28.. _libc++: http://libcxx.llvm.org/
29.. _Python 2.4: http://python.org/download/
30
Nick Kledzikf7848172012-04-26 23:41:01 +0000312. Check out LLVM::
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000032
33 $ cd path/to/llvm-project
34 $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
35
Nick Kledzikf7848172012-04-26 23:41:01 +0000363. Check out lld::
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000037
38 $ cd llvm/tools
39 $ svn co http://llvm.org/svn/llvm-project/lld/trunk lld
40
41 * lld can also be checked out to ``path/to/llvm-project`` and built as an external
42 project.
43
Nick Kledzikf7848172012-04-26 23:41:01 +0000444. Build LLVM and lld::
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000045
46 $ cd path/to/llvm-build/llvm (out of source build required)
47 $ cmake -G "Unix Makefiles" path/to/llvm-project/llvm
48 $ make
49
Nick Kledzikf7848172012-04-26 23:41:01 +000050 * If you want to build with clang and it is not the default compiler or
51 it is installed in an alternate location, you'll need to tell the cmake tool
52 the location of the C and C++ compiler via CMAKE_C_COMPILER and
53 CMAKE_CXX_COMPILER. For example::
54 $ cmake -DCMAKE_CXX_COMPILER=/path/to/clang++ -DCMAKE_C_COMPILER=/path/to/clang ...
55
565. Test::
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000057
58 $ make lld-test
59
60Using Visual Studio
61~~~~~~~~~~~~~~~~~~~
62
63#. Get the required tools.
64
65 * `CMake 2.8`_\+.
66 * `Visual Studio 11`_ (required for C++11 support)
67 * `Python 2.4`_\+ (not 3.x) for running tests.
68
69.. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html
70.. _Visual Studio 11: http://www.microsoft.com/visualstudio/11/en-us
71.. _Python 2.4: http://python.org/download/
72
73#. Check out LLVM::
74
75 $ cd path/to/llvm-project
76 $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
77
78#. Check out lld::
79
80 $ cd llvm/tools
81 $ svn co http://llvm.org/svn/llvm-project/lld/trunk lld
82
83 * lld can also be checked out to ``path/to/llvm-project`` and built as an external
84 project.
85
86#. Generate Visual Studio project files::
87
88 $ cd path/to/llvm-build/llvm (out of source build required)
89 $ cmake -G "Visual Studio 11" path/to/llvm-project/llvm
90
91#. Build
92
93 * Open LLVM.sln in Visual Studio.
94 * Build the ``ALL_BUILD`` target.
95
96#. Test
97
98 * Build the ``lld-test`` target.
99
100More Information
101~~~~~~~~~~~~~~~~
102
103For more information on using CMake see the `LLVM CMake guide`_.
104
105.. _LLVM Cmake guide: http://llvm.org/docs/CMake.html