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,664

3 Answers3

12

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
  • 231
  • 1
  • 3
2

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 .

1

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
  • 34,963