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
?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communitysudo 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
--slave
instead of independent rules - what are your thoughts? update-alternatives
doesn't look like it's doing much more than chaining symlinks, but I haven't used it enough to know what can go wrong.
gcc
with a priority of 20 and clang
with a priority of 10; in auto mode, update-alternatives
selects gcc
. I could run the above with a priority of 50 and it would set the auto preference of clang-3.8
above both existing options
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.
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.
sudo update-alternatives --install "/usr/bin/clang" "clang" "[path-to]/clang" 1000
, like this java example askubuntu.com/questions/56104/…