Skip to content

Instantly share code, notes, and snippets.

@wfxr
Last active September 28, 2016 14:47
Show Gist options
  • Save wfxr/d92d2a789a6985cd56f8 to your computer and use it in GitHub Desktop.
Save wfxr/d92d2a789a6985cd56f8 to your computer and use it in GitHub Desktop.

使用Ubuntu源安装

Installing llvm 3.9 can easily be done under Xenial Xerus by using the 'LLVM Debian/Ubuntu nightly packages' PPA. Just follow these steps:

Add the archive signature:

wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -

Add the PPA:

sudo apt-add-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main"

Allow the Repository to reload and then run the following command:

sudo apt-get install clang-3.9 lldb-3.9

Test your installation as follows, as shown on my own Xenial system:

$ clang-3.9 --version
clang version 3.9.0-svn275716-1~exp1 (trunk)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Note: There may be some authentication warnings for the llvm key which I have safely overridden on my own system...

References:

LLVM Debian/Ubuntu nightly packages


从源码编译安装

安装Ninja和CMake

    $ sudo apt-get install cmake
    
    $ git clone git://github.com/ninja-build/ninja.git && cd ninja
    $ git checkout release
    $ vim README

下载llvm工具链源码

编译安装

    $ mkdir build & cd build
    $ cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr path/to/llvm/sources
    $ ln -s $PWD/compile_commands.json path/to/llvm/source/
    $ ninja
    $ sudo ninja install

下载预编译的二进制文件

http://llvm.org/releases/download.html

下载对应版本,解压后拷贝到/usr/usr/local/(推荐)即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment