Set clang-3.8 as default
I have installed clang 3.0 and clang 3.8:
$ sudo update-alternatives --config clang
update-alternatives: error: no alternatives for clang.
How can I set 3.8 as /usr/bin/clang
?
Solution 1:
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-3.8 100
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.8 100
Solution 2:
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 81 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-8 --slave /usr/share/man/man1/clang.1.gz clang.1.gz /usr/share/man/man1/clang-8.1.gz --slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-8 --slave /usr/bin/clang-format clang-format /usr/bin/clang-format-8
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-6.0 60 --slave /usr/bin/clang++ clang++ /usr/bin/clang++-6.0 --slave /usr/share/man/man1/clang.1.gz clang.1.gz /usr/share/man/man1/clang-6.0.1.gz --slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-6.0 --slave /usr/bin/clang-format clang-format /usr/bin/clang-format-6.0
These commands will add 2 entries and default selected as clang-8. You can configure using
sudo update-alternatives --config clang
This will update clang, clang++, man pages, clang-format, clang-tidy.
Solution 3:
Try:
sudo update-alternatives --config cc
And it will present the list of options for you to choose.
make utility uses the command cc to compile, which is actually a link to gcc, clang etc.