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__ https://bugs.llvm.org/
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 and subprojects (including lld)::
32
33     $ git clone https://github.com/llvm/llvm-project.git
34
354. Build LLVM and lld::
36
37     $ cd llvm-project
38     $ mkdir build && cd build
39     $ cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS=lld ../llvm
40     $ make
41
42  * If you want to build with clang and it is not the default compiler or
43    it is installed in an alternate location, you'll need to tell the cmake tool
44    the location of the C and C++ compiler via CMAKE_C_COMPILER and
45    CMAKE_CXX_COMPILER. For example::
46
47        $ cmake -DCMAKE_CXX_COMPILER=/path/to/clang++ -DCMAKE_C_COMPILER=/path/to/clang ...
48
495. Test::
50
51     $ make check-lld
52
53Using Visual Studio
54~~~~~~~~~~~~~~~~~~~
55
56#. Get the required tools.
57
58  * `CMake 2.8`_\+.
59  * `Visual Studio 12 (2013) or later`_ (required for C++11 support)
60  * `Python 2.4`_\+ (not 3.x) for running tests.
61
62.. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html
63.. _Visual Studio 12 (2013) or later: http://www.microsoft.com/visualstudio/11/en-us
64.. _Python 2.4: http://python.org/download/
65
66#. Check out LLVM as above.
67
68#. Generate Visual Studio project files::
69
70     $ cd llvm-project/build (out of source build required)
71     $ cmake -G "Visual Studio 11" -DLLVM_ENABLE_PROJECTS=lld ../llvm
72
73#. Build
74
75  * Open LLVM.sln in Visual Studio.
76  * Build the ``ALL_BUILD`` target.
77
78#. Test
79
80  * Build the ``lld-test`` target.
81
82More Information
83~~~~~~~~~~~~~~~~
84
85For more information on using CMake see the `LLVM CMake guide`_.
86
87.. _LLVM CMake guide: https://llvm.org/docs/CMake.html
88