How to install clang on Ubuntu 14.04
阿新 • • 發佈:2019-02-14
For one thing, installing clang on Ubuntu is a time spending task.
You can do it as the way through the link Clang-getting started( I don't suggest that, cause I didn't successful).
Here is my way!
First you need to install the application of g++, cmake, subversion.
{CSDN:CODE:sudo apt-get install g++}{CSDN:CODE:sudo apt-get install cmake}
{CSDN:CODE:sudo apt-get install subversion}
Second, you need to make a directory to repository the whole stuff, including source file, makefile or something else. You can do it like this:
{CSDN:CODE: mkdir ~/Software_Source/Clang_source && cd ~/Software_Source/Clang_source}
Third, you need to download the stuff of llvm and clang using the program of svn:
{CSDN:CODE:svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
{CSDN:CODE:cd llvm/tools}
{CSDN:CODE:svn co http://llvm.org/svn/llvm-project/cfe/trunk clang}
Forth, when that was done. You will enter the step of installing the clang, which contains configure->make->make install.
{CSDN:CODE:cd ../..}
{CSDN:CODE:mkdir build $$ cd build}
{CSDN:CODE:../configure --prefix=/usr/clang --enable-optimized --enable-targets=host --disable-compiler-version-checks
{CSDN:CODE:make}
{CSDN:CODE:make install}
Fifth, set the environment PATH variable.
{CSDN:CODE:cd ~ && vim .bashrc}
and append "export PATH=/usr/clang/bin:$PATH"(ATTENTION: no space is allowed beside the one between 'export and PATH')
Sixth, close the terminal and reopen it. type "clang --help" to checkout.