I am trying to compile a C++ project on a PC with "Debian GNU/Linux 10". The project requires clang, so I installed it with:
sudo apt-get install clang
But I run into the following error:
Clang version must be at least 11, the version used is 7.0.1
How can I install clang 11?
Note: I do not want to install the entire LLVM package again. Just want to upgrade Clang from version 7 to 11, preferably via command-line.
I found the solution after some searching. Here is what I did to make it work:
deb http://apt.llvm.org/buster/ llvm-toolchain-buster main
deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster main
deb http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main
deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main
deb http://apt.llvm.org/buster/ llvm-toolchain-buster-11 main
deb-src http://apt.llvm.org/buster/ llvm-toolchain-buster-11 main
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install clang-11
export CMAKE_C_COMPILER=clang-11
export CMAKE_CXX_COMPILER=clang++-11
For documentation: https://apt.llvm.org/