How to install LLVM 3.9

I'm working with Emscripten and one of the error messages is:

LLVM version appears incorrect (seeing "3.3", expected "3.9")

But I can't find 3.9 on the LLVM page:

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

What can I do to install LLVM 3.9?


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

  1. Add the archive signature:

    wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
    
  2. Add the PPA:

    sudo apt-add-repository "deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-3.9 main"
    sudo apt-get update
    

    Note: There may be some authentication warnings for the llvm key which I have safely overridden on my own system. To bypass authentication, replace sudo apt-get update with

    sudo apt -o Acquire::AllowInsecureRepositories=true update
    
  3. Allow the Repository to reload and then run the following command:

    sudo apt-get install clang-3.9 lldb-3.9
    
  4. 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
    

References:

  • LLVM Debian/Ubuntu nightly packages

Add following two lines in /etc/apt/sources.list file using nano or vim or any other your favorite text editor.

deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main
deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main

Above lines are for Ubuntu 14.04 LTS. If you are using Ubuntu 15.10, just replace trusty with wily in above lines. If you are using Ubuntu 16.04 LTS, replace trusty with xenial.

Type following commands to install LLVM 3.9

sudo apt-get update 
sudo apt-get install clang-3.9 lldb-3.9

Follow this official guidance http://apt.llvm.org/

e.g. for Ubuntu 14.04
Add following lines in /etc/apt/sources.list file

deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main deb-src http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main

To retrieve the archive signature: wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -

Install stable branch apt-get install clang-3.9 lldb-3.9