How to build LLVM Debian/Ubuntu packages from source?
Building the latest nightly snapshot

The latest nightly snapshot can be built with the following steps. First, ensure you add to your apt.sources the nightly repositories for your distribution.

Use apt-get to retrieve the sources of the llvm-toolchain-snapshot package,

$ mkdir build/ && cd build/
$ apt-get source llvm-toolchain-snapshot

This should download all the original snapshot tarballs, and create a directory named llvm-toolchain-snapshot-3.9~svn270412. Depending on the last update of the jenkins nightly builder, the snapshot version number and svn release will vary.

Then install the build dependencies,

$ sudo apt-get build-dep llvm-toolchain-snapshot

On older versions of Ubuntu, some build dependencies cannot be satisfied because the required gcc versions are missing. To fix this issue you should add the Ubuntu Toolchain PPA to your system before executing the above command.

Once everything is ready, enter the directory and build the package,

$ cd llvm-toolchain-snapshot-3.9~svn270412/
$ debuild -us -uc -b

Building a snapshot package by hand

In some cases you may want to build a snapshot package manually. For example to debug the Debian package scripts, or to build a package for a specific development branch. In that scenario, follow the following steps:

  1. Checkout the llvm-toolchain source package.

    The source package is maintained in SVN, you can retrieve it using the debcheckout command,

    $ debcheckout svn://

  2. Retrieve the latest snapshot and create original tarballs.

    From the branches/ directory run the script,

    $ sh snapshot/debian/

    which will retrieve the latest version for each LLVM subproject (llvm, clang, lldb, etc.) from the main development SVN and repack it as a set of tarballs.

  3. Unpack the original tarballs and apply quilt Debian patches.

    From the branches/ directory run the script,

    $ sh

    which will unpack the source tree inside a new directory such as branches/llvm-toolchain-snapshot_3.9~svn268942. Depending on the current snapshot version number and svn release, the directory name will be different. Quilt patches will then be applied.

  4. Build the binary packages using,

    $ fakeroot debian/rules binary

    When debugging, successive builds can be recompiled faster by using tools such as ccache (PATH=/usr/lib/ccache:$PATH fakeroot debian/rules binary).

Retrieving a specific branch or release candidate with

When using, if you need to retrieve a specific branch, you can pass the branch name as the first argument. For example, to get the 3.8 release branch at{llvm,...}/branches/release_38 you should use,

$ sh 3.8/debian/ release_38

To retrieve a specific release candidate, you can pass the branch name as the first argument, and the tag rc number as the second argument. For example, to get the 3.8.0 release candidate rc3 at{llvm,...}/tags/RELEASE_380/rc3 you should use,

$ sh 3.8/debian/ RELEASE_380 rc3

Organization of the repository

The Debian package for each LLVM point release is maintained as a separate SVN branch in the branches/ directory. For example, the 3.8 release lives at branches/3.8.

The current snapshot release is maintained at branches/snapshot.

Additional maintainer scripts

The script that is found at the SVN root should be used to quickly test a newly built clang package. It runs a short set of sanity-check tests.

The script releases/snapshot/debian/ is used when preparing a new point release. It automatically replaces version numbers in various files of the package.

Contact: Sylvestre Ledru
Build infra by IRILL / Hosting by LLVM Foundation