Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to compile and install Clang on Linux CentOS

Shulou Source: shulou.com Published: 2022-06-01 14:44:50 10月01日 Update

This article introduces the knowledge of "how to compile and install Clang on Linux CentOS". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

I. Environmental preparation before installing Clang in Minimal version of CentOS

1, install gcc:yum install gcc

2, install g++:yum install gcc-c++

3. Install cmake with source code:

The reason for using source code installation is that the default installation version of yum is too low, while Clang requires the version of cmake.

Source code download address: https://cmake.org/download/

Unzip it and execute it in the cmake directory in turn.

1). / bootstrap

2) gmake

3) make install

4) cmake-version

4Perl installation: yum install perl

Because the pod2html command is required during the installation of the Clang script, perl needs to be installed.

II. Clang installation (version 3.6.0)

1. Download the source code at http://llvm.org/releases/download.html

The main downloads are as follows:

2. Extract the four files after the download is completed.

1) rename clang-tools-extra-3.6.0.src.tar.xz to extra after decompression

2) rename cfe-3.6.0.src.tar.xz to clang after decompression

3) rename llvm-3.6.0.src.tar.xz to llvm after decompression

4) after decompression, compiler-rt-3.6.0.src.tar.xz is named compiler-rt.

Store the four files in the following directory structure:

That is, put compiler-rt under the projects directory under the llvm directory. And so on.

3Quinting Clang installation

1)

. / configure-- enable-optimized-- enable-targets=host-only-- prefix=/home/YouPathToInstall/ll

2) make

3) make install

4) clang-version

Note: Clang has version requirements for gcc,g++,cmake, etc., try not to install the version too low.

This is the end of "how to compile and install Clang on Linux CentOS". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Version source code directory file upper editor content address more source code download knowledge process practical successful learning next reason command dilemma actual situation article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MySQL Huawei MariaDB Linux