blob: 97c3d1bccbda4bd450d587a43e16e5b81e6e213c [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::
Nick Kledzik920cedd2012-06-18 20:24:47 +000054
Nick Kledzikf7848172012-04-26 23:41:01 +000055 $ cmake -DCMAKE_CXX_COMPILER=/path/to/clang++ -DCMAKE_C_COMPILER=/path/to/clang ...
56
575. Test::
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000058
Rui Ueyama905c41b2015-11-18 23:53:19 +000059 $ make check-lld
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000060
61Using Visual Studio
62~~~~~~~~~~~~~~~~~~~
63
64#. Get the required tools.
65
66 * `CMake 2.8`_\+.
Rui Ueyama905c41b2015-11-18 23:53:19 +000067 * `Visual Studio 12 (2013) or later`_ (required for C++11 support)
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000068 * `Python 2.4`_\+ (not 3.x) for running tests.
69
70.. _CMake 2.8: http://www.cmake.org/cmake/resources/software.html
Hans Wennborgc89f8052016-01-27 17:54:35 +000071.. _Visual Studio 12 (2013) or later: http://www.microsoft.com/visualstudio/11/en-us
Michael J. Spencer365f1ec2012-04-25 19:34:24 +000072.. _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
Alex Rosenbergb65e8882013-02-03 07:05:26 +0000106.. _LLVM CMake guide: http://llvm.org/docs/CMake.html