I just installed clang++3.6 on my Ubuntu machine, but can\'t set it as the default c++ compiler.
sudo update-alternatives --config c++
tells
Since clang is referenced directly as well as via cc, I would break this up into alternatives for clang, and alternatives for cc. After clang is set up below:
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100
To select the version of clang, and cc:
sudo update-alternatives --config clang
sudo update-alternatives --config clang++
sudo update-alternatives --config cc
sudo update-alternatives --config c++
Setting up clang/clang++. Multiple versions of clang are packaged with Ubuntu. In 15.10, for example:
clang-3.4 - C, C++ and Objective-C compiler (LLVM based)
clang-3.5 - C, C++ and Objective-C compiler (LLVM based)
clang-3.6 - C, C++ and Objective-C compiler (LLVM based)
clang-3.7 - C, C++ and Objective-C compiler (LLVM based)
The highest priority alternative is auto, and the rest are manually selected. So if my default were to be the latest, and 4 versions were installed:
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.7 370
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.7 370
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.6 360
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.6 360
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.5 350
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.5 350
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.4 340
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.4 340
If you apply the same to LLDB, you have a fairly complete development environment that includes cross-compilers/debuggers for several architectures. ('fairly' means that the linker, LLD, is not quite mature enough to say complete).
Note: LLDB + Python-LLDB are needed for a complete debugger. Multiple versions of python-lldb CANNOT be installed together, so the best option at this point is to pick the latest version of LLDB with it's associated python package.