Table Of Contents

Previous topic

Linker Design

Next topic

Development

This Page

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

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.
  1. Check out LLVM:

    $ cd path/to/llvm-project
    $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
  2. 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.
  1. 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 ...
  1. Test:

    $ make lld-test

Using Visual Studio

  1. Get the required tools.
  1. Check out LLVM:

    $ cd path/to/llvm-project
    $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
  2. 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.
  1. 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
  2. Build

  • Open LLVM.sln in Visual Studio.
  • Build the ALL_BUILD target.
  1. Test
  • Build the lld-test target.

More Information

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