Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 12393  / 3 Years ago, sat, september 4, 2021, 2:27:09

Meanwhile LLVM has released apt packages for LLVM 13 and 14 but out-of-the box clang-format-13, clang-tidy-13, ... are not available via apt-get install clang-format-13.


How can I install clang-format-13 on Ubuntu 18.04?


More From » 18.04

 Answers
6

First of all do a sudo apt update and an optional sudo apt upgrade and check everything is fine and works.
Second backup the sources.list you want to update (next).


Add the matching repository from https://apt.llvm.org/ to one of your sources, e.g. /etc/apt/sources.list. Example:


sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main'

That should add the following to the end of your /etc/apt/sources.list:


deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main
# deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main

Then execute sudo apt update. In case you get an error stating 'The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ...' then you have to add the missing public key with apt-key add:


# download key file
wget https://apt.llvm.org/llvm-snapshot.gpg.key
# add the key
sudo apt-key add llvm-snapshot.gpg.key

One liner: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -. Please notice that you now trust the packages with that key!


Then you can install clang-format-13, clang-tidy-13 on Ubuntu 18.04:


sudo apt update
sudo apt install clang-format-13

This should also work for Ubuntu 20.04 (http://apt.llvm.org/focal/ and llvm-toolchain-focal-13) or clang-format-14.


[#493] Sunday, September 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fatuatexen

Total Points: 451
Total Questions: 107
Total Answers: 110

Location: Trinidad and Tobago
Member since Thu, Apr 27, 2023
1 Year ago
fatuatexen questions
Sat, May 21, 22, 08:47, 2 Years ago
Sun, Jul 11, 21, 22:44, 3 Years ago
Thu, May 25, 23, 15:11, 1 Year ago
;