getting_started.rst revision 337173
1.. _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
171. Get the required tools.
18
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
312. Check out LLVM::
32
33     $ cd path/to/llvm-project
34     $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
35
363. Check out lld::
37
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
444. Build LLVM and lld::
45
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
50  * 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
55        $ cmake -DCMAKE_CXX_COMPILER=/path/to/clang++ -DCMAKE_C_COMPILER=/path/to/clang ...
56
575. Test::
58
59     $ make check-lld
60
61Using Visual Studio
62~~~~~~~~~~~~~~~~~~~
63
64#. Get the required tools.
65
66  * `CMake 2.8`_\+.
67  * `Visual Studio 12 (2013) or later`_ (required for C++11 support)
68  * `Python 2.4`_\+ (not 3.x) for running tests.
69
70.. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html
71.. _Visual Studio 12 (2013) or later: http://www.microsoft.com/visualstudio/11/en-us
72.. _Python 2.4: http://python.org/download/
73
74#. Check out LLVM::
75
76     $ cd path/to/llvm-project
77     $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
78
79#. Check out lld::
80
81     $ cd llvm/tools
82     $ svn co http://llvm.org/svn/llvm-project/lld/trunk lld
83
84  * lld can also be checked out to ``path/to/llvm-project`` and built as an external
85    project.
86
87#. Generate Visual Studio project files::
88
89     $ cd path/to/llvm-build/llvm (out of source build required)
90     $ cmake -G "Visual Studio 11" path/to/llvm-project/llvm
91
92#. Build
93
94  * Open LLVM.sln in Visual Studio.
95  * Build the ``ALL_BUILD`` target.
96
97#. Test
98
99  * Build the ``lld-test`` target.
100
101More Information
102~~~~~~~~~~~~~~~~
103
104For more information on using CMake see the `LLVM CMake guide`_.
105
106.. _LLVM CMake guide: http://llvm.org/docs/CMake.html
107