Ubuntu – Installing clang 3.8 on Ubuntu 14.04.3

aptaptitudeclang

I've tried the following obvious commands:

sudo apt-get update
sudo apt-get install clang-3.8

but I get the message:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

and I've tried:

sudo apt-get update
sudo aptitude install clang-3.8

but get the message:

Couldn't find package "clang-3.8".  However, the following
packages contain "clang-3.8" in their name:
  clang-3.8-doc 
Couldn't find package "clang-3.8".  However, the following
packages contain "clang-3.8" in their name:
  clang-3.8-doc 
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.

Hoping for a version of clang more recent than 3.5. Any suggestions?

Best Answer

  • Looks like the latest version for 14.04.3 is clang 3.6 in Trusty Updates. But the developers maintain a PPA which should get you the latest version:

    LLVM Debian/Ubuntu nightly packages

    To install 3.8 you would first add the key:

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

    and then add the repository for 3.8 by adding the following line manually to /etc/apt/sources.list (or using the gui 'Software & Updates'):

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

    Screenshot here to demonstrate the technique:

    enter image description here

    Then run the following:

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

    Test the installation as follows:

    andrew@corinth:~$ clang-3.8 --version
    clang version 3.8.0-svn262614-1~exp1 (branches/release_38)
    Target: x86_64-unknown-linux-gnu
    Thread model: posix
    InstalledDir: /usr/bin
    andrew@corinth:~$ 
    

    And hopefully this will get you going...

  • Related Question