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
$ sudo apt-get install cmake
$ git clone git://github.com/ninja-build/ninja.git && cd ninja
$ git checkout release
$ vim README
$ 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/
(推荐)即可