9

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?

  • Make one or more clang entries to /etc/alternatives/ : sudo update-alternatives --install "/usr/bin/clang" "clang" "[path-to]/clang" 1000 , like this java example askubuntu.com/questions/56104/… – Knud Larsen Jun 26 '16 at 20:36
  • Actually, the name is 'cc'. So you need to issue: sudo update-alternatives --config cc – duli Dec 15 '18 at 16:23
22
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
  • I was following another example that used '60' to represent '6.0' and --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. – John P Jun 4 '18 at 10:04
  • Thanks you for the answer. What does the 100 at the end mean? – banarun Feb 1 at 12:53
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.