Adding to Yan Foto's answer (and just in case your aim is to get a usable clang
but not necessarily use it as cc
), you can actually add the entire set of programs in one go using
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 380 \
--slave /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 \
--slave /usr/bin/clang-check clang-check /usr/bin/clang-check-3.8 \
--slave /usr/bin/clang-query clang-query /usr/bin/clang-query-3.8 \
--slave /usr/bin/clang-rename clang-rename /usr/bin/clang-rename-3.8
(Note that the set of binaries that come with each clang version might differ, e.g. 3.6 does have clang-tblgen
, 3.8 doesn't.)
If you repeat this for every version of clang you install, you'll be able to switch between them using just a single update-alternatives
command.
(Meanwhile, apparently, there is still an ongoing debate about whether to include these links with Ubuntu packages or not: https://bugs.launchpad.net/ubuntu/+source/llvm-3.1/+bug/991493)