summaryrefslogtreecommitdiff
path: root/lld/docs/getting_started.rst
blob: 97c3d1bccbda4bd450d587a43e16e5b81e6e213c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
.. _getting_started:

Getting Started: Building and Running lld
=========================================

This page gives you the shortest path to checking out and building lld. If you
run into problems, please file bugs in the `LLVM Bugzilla`__

__ http://llvm.org/bugs/

Building lld
------------

On Unix-like Systems
~~~~~~~~~~~~~~~~~~~~

1. Get the required tools.

  * `CMake 2.8`_\+.
  * make (or any build system CMake supports).
  * `Clang 3.1`_\+ or GCC 4.7+ (C++11 support is required).

    * If using Clang, you will also need `libc++`_.
  * `Python 2.4`_\+ (not 3.x) for running tests.

.. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html
.. _Clang 3.1: http://clang.llvm.org/
.. _libc++: http://libcxx.llvm.org/
.. _Python 2.4: http://python.org/download/

2. Check out LLVM::

     $ cd path/to/llvm-project
     $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm

3. Check out lld::

     $ cd llvm/tools
     $ svn co http://llvm.org/svn/llvm-project/lld/trunk lld

  * lld can also be checked out to ``path/to/llvm-project`` and built as an external
    project.

4. Build LLVM and lld::

     $ cd path/to/llvm-build/llvm (out of source build required)
     $ cmake -G "Unix Makefiles" path/to/llvm-project/llvm
     $ make

  * If you want to build with clang and it is not the default compiler or
    it is installed in an alternate location, you'll need to tell the cmake tool
    the location of the C and C++ compiler via CMAKE_C_COMPILER and
    CMAKE_CXX_COMPILER. For example::

        $ cmake -DCMAKE_CXX_COMPILER=/path/to/clang++ -DCMAKE_C_COMPILER=/path/to/clang ...

5. Test::

     $ make check-lld

Using Visual Studio
~~~~~~~~~~~~~~~~~~~

#. Get the required tools.

  * `CMake 2.8`_\+.
  * `Visual Studio 12 (2013) or later`_ (required for C++11 support)
  * `Python 2.4`_\+ (not 3.x) for running tests.

.. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html
.. _Visual Studio 12 (2013) or later: http://www.microsoft.com/visualstudio/11/en-us
.. _Python 2.4: http://python.org/download/

#. Check out LLVM::

     $ cd path/to/llvm-project
     $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm

#. Check out lld::

     $ cd llvm/tools
     $ svn co http://llvm.org/svn/llvm-project/lld/trunk lld

  * lld can also be checked out to ``path/to/llvm-project`` and built as an external
    project.

#. Generate Visual Studio project files::

     $ cd path/to/llvm-build/llvm (out of source build required)
     $ cmake -G "Visual Studio 11" path/to/llvm-project/llvm

#. Build

  * Open LLVM.sln in Visual Studio.
  * Build the ``ALL_BUILD`` target.

#. Test

  * Build the ``lld-test`` target.

More Information
~~~~~~~~~~~~~~~~

For more information on using CMake see the `LLVM CMake guide`_.

.. _LLVM CMake guide: http://llvm.org/docs/CMake.html