6

Can you help me install clang-14 on Ubuntu 18.04? I think I need a valid repo as apt-get install clang-14 does not work.

$ cat /etc/issue
Ubuntu 18.04 LTS \n \l

$ sudo apt-get update Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease Hit:3 http://us.archive.ubuntu.com/ubuntu bionic-updates InRelease Reading package lists... Done

$ sudo apt-get install clang-14 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package clang-14

$ clang++ -v clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.5.0 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0 Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8 Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0 Candidate multilib: .;@m64 Selected multilib: .;@m64

Nmath
  • 12,333
SpeedChaser
  • 63
  • 1
  • 1
  • 4

3 Answers3

10

You can download clang 14 for with the instructions on the llvm page here:

wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 14
PeterT
  • 201
  • 1
  • 3
  • It fails with the following: Distribution 'ubuntu' in version '18.04.6 LTS (Bionic Beaver)' is not supported by this script. – fsquirrel Aug 04 '22 at 10:06
  • It worked for me for clang-12 as well. just changed last line sudo ./llvm.sh 12 – DevMJ Dec 16 '22 at 16:59
1

You neded ubuntu-toolchain-r ppa in bionic

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt update && sudo apt upgrade

wget https://apt.llvm.org/llvm.sh

chmod +x llvm.sh

sudo ./llvm.sh 14

And now are installed with clang-14 and clang++-14 .

0

clang-14 is not available for your release ... but available as of Ubuntu 22.04

So, upgrading to 22.04 is what you might want to consider.

Raffa
  • 32,237
  • Thanks for the clarification! – SpeedChaser Jun 24 '22 at 16:52
  • Updating to Ubuntu 22.04 is not always possible. Both because there are a lot of performance downgrades that make it undesirable (snap everywhere, for example), but also because: on work servers, we can't just choose to upgrade, that's decided at a totally different organizational level. – James Feb 08 '23 at 18:54