Building CircleCI VM with a modern Clang / LLVM toolchain



Does anyone have a recipe for getting a more modern version of the Clang / LLVM toolchain working on the CircleCI Ubuntu 12.04 VM?

The existing options appear to be:
-The v3.0 Clang built into Ubuntu 12.04 (which lacks some C++11 and clang-format features)
-The v3.4 Clang available as a package on (which throws an error when I try to install it via apt-get on the VM)
-Building a v3.6 Clang from a PPA such as (which leads to time-outs because of the required dist-upgrade)

Does anyone else use a recent version of Clang in their CircleCI builds?



I was able to install clang-3.4 by adding the following to the circle.yml file:

    - sudo apt-get update; sudo apt-get remove llvm-3.0; sudo apt-get install llvm-3.4 libclang1-3.4 llvm-3.4-dev

Could you please check if that works for you as well?


No dice - the default clang still points to LLVM 3.0, and Clang 3.4 still fails to install:

$ sudo apt-get update
$ sudo apt-get remove llvm-3.0
$ sudo apt-get install llvm-3.4 libclang1-3.4 llvm-3.4-dev

$ which clang

$ clang --version
Exit code: 0
clang --version
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

$ sudo apt-get install clang-3.4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 clang-3.4 : Depends: libclang-common-3.4-dev (= 1:3.4-1ubuntu3~precise2) but it is not going to be installed

sudo apt-get install clang-3.4 returned exit code 100

E: Unable to correct problems, you have held broken packages. Action failed: sudo apt-get install clang-3.4


Sorry for the delay here @bnbowman.

I was able to make it work by doing the following after removing llvm-3.4 and before installing the new clang:

$ sudo apt-get remove clang

$ sudo apt-get install clang-3.4 libclang-common-3.4-dev libllvm3.4=1:3.4-1ubuntu3~precise2

This results in:

$ clang --version
Ubuntu clang version 3.4-1ubuntu3~precise2 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix

Could you please try it out?