By enabling the SCL repository you can install Clang 5.0.1 on CentOS 7 using the llvm-toolset-7 package.
$ sudo yum install centos-release-scl
$ sudo yum install llvm-toolset-7
Enable llvm-toolset-7:
$ scl enable llvm-toolset-7 bash
You can now check you clang version with:
$ clang --version
See this Red Hat blog post for more information.
For more information about SCL, see this page.
Answer from johnthagen on Stack OverflowBy enabling the SCL repository you can install Clang 5.0.1 on CentOS 7 using the llvm-toolset-7 package.
$ sudo yum install centos-release-scl
$ sudo yum install llvm-toolset-7
Enable llvm-toolset-7:
$ scl enable llvm-toolset-7 bash
You can now check you clang version with:
$ clang --version
See this Red Hat blog post for more information.
For more information about SCL, see this page.
There was a much easier way to achieve this:
Add the Alonid's repo to /etc/yum.repos.d/epel.repo (assuming you have epel repo installed)
echo "[alonid-llvm-3.9.0]
name=Copr repo for llvm-3.9.0 owned by alonid
baseurl=https://copr-be.cloud.fedoraproject.org/results/alonid/llvm-
3.9.0/epel-7-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/alonid/llvm-
3.9.0/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1" >> /etc/yum.repos.d/epel.repo
Then just sudo yum install clang-3.9.0
--- UPDATE ---
I now have :
-
gcc (GCC) 7.1.0 (built from sources)
With it and cmake3 I can now try to build Clangd but I get an error during the make -j 8.
Details of the error can be found in this comment but the takeaway is :
[ 6%] Building CXX object lib/Support/CMakeFiles/LLVMSupport.dir/Process.cpp.o
In file included from /home/kavan/Downloads/llvm-project/llvm/lib/Support/Process.cpp:107:0:
/home/kavan/Downloads/llvm-project/llvm/lib/Support/Unix/Process.inc: Dans la fonction membre statique « static std::error_code llvm::sys::Process::FixupStandardFileDescriptors() »:
/home/kavan/Downloads/llvm-project/llvm/lib/Support/Unix/Process.inc:209:54: error: initialisation invalide pour une référence du type « int (&)(int, stat*) noexcept » à partir d'une expression de type « int(int, stat*) noexcept »
if (RetryAfterSignal(-1, ::fstat, StandardFD, &st) < 0) {
^
In file included from /home/kavan/Downloads/llvm-project/llvm/lib/Support/Unix/Unix.h:23:0,
from /home/kavan/Downloads/llvm-project/llvm/lib/Support/Unix/Process.inc:13,
from /home/kavan/Downloads/llvm-project/llvm/lib/Support/Process.cpp:107:
/home/kavan/Downloads/llvm-project/llvm/include/llvm/Support/Errno.h:32:23: note: dans le passage de l'argument 2 de « decltype(auto) llvm::sys::RetryAfterSignal(const FailT&, const Fun&, const Args& ...) [avec FailT = int; Fun = int(int, stat*) noexcept; Args = {int, stat*}] »
inline decltype(auto) RetryAfterSignal(const FailT &Fail, const Fun &F,
^~~~~~~~~~~~~~~~
make[2]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/Process.cpp.o] Erreur 1
make[1]: *** [lib/Support/CMakeFiles/LLVMSupport.dir/all] Erreur 2
make: *** [all] Erreur 2Any help is welcome.
--- END UPDATE ---
CentOS 7 is required for my work, usually I use Neovim with Clangd to develop.
Here are the version of some programs that could be of use :
-
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
-
GNU Make 3.82
-
cmake3 version 3.17.5
-
cmake version 2.8.12.2
-
clang version 3.4.2 (tags/RELEASE_34/dot2-final)
Clangd isn't in the yum repos (although clang version 3.4.2 is).
I tried installing clangd via snap, but clangd --version just never gives the prompt back without printing anything (Ctrl-C needed to get the prompt back).
I tried building it from source, but gcc isn't recent enough :
CMake Error at cmake/modules/CheckCompilerVersion.cmake:37 (message): Host GCC version must be at least 7.1, your version is 4.8.5.
Has anyone been in this situation before ?