Compiling and installing Clang 3.5.0 on Linux CentOS

Source: Internet
Author: User
Tags install openssl

Compiling CORECLR requires clang 3.5, and CentOS is installed Clang 3.4.2 (the most new version of Yum repos is this), can only be manually compiled LLVM source code to install.

(Note: The CentOS version is 6.6)

First, install the libstdc++4.7

wget Http://people.centos.org/tru/devtools-2/devtools-2.repo-O/etc/yum.repos.d/devtools-2.repoyum Install DEVTOOLSET-2-GCC devtoolset-2-binutils devtoolset-2-gcc-c++ln-s/opt/rh/devtoolset-2/root/usr/bin/*/usr/local/bin /

If you do not install, the following error message appears when you configure the compile option in configure:

We detected a missing feature in the standard C + + library that is known to bemissing in libstdc++4.6 and implemented in L ibstdc++4.7. There is numerousc++11 problems with 4.6 's library, and we don ' t support GCCS or libstdc++ Olderthan 4.7.

Second, install Python 2.7.9

CentOS 6.6 comes with Python 2.6.6, while compiling LLVM requires more than Python 2.7.

1) Install the packages needed to compile Python

Yum Install Zlib-develyum install Bzip2-develyum install Openssl-develyum install Ncurses-develyum install Sqlite-devel

2) Download and unzip the source code of the Python 2.7.9

Cd/optwget--no-check-certificate Https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xztar XF PYTHON-2.7.9.TAR.XZCD Python-2.7.9

3) Compiling and installing Python 2.7.9

./configure--prefix=/usr/localmake && make Altinstall

4) Point python command to Python 2.7.9

Ln-s/usr/local/bin/python2.7/usr/local/bin/python

Third, compiling LLVM

1) Download the LLVM source code

HTTP://LLVM.ORG/RELEASES/3.5.0/LLVM-3.5.0.SRC.TAR.XZMV llvm-3.5.0.src LLVM

2) Download the clang source code

CD llvm/toolswget Http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xztar XF cfe-3.5.0.src.tar.xzmv cfe-3.5.0.src Clang

3) Download the COMPILER-RT source code

Cd.. /projectswget Http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xztar XF COMPILER-RT-3.5.0.SRC.TAR.XZMV COMPILER-RT-3.5.0.SRC Compiler-rt

4) Configure compilation options

Cd..
./configure--enable-optimized CC=GCC cxx=g++

5) Compiling LLVM

Make-j2

Tips after successful compilation:

LLVM[0]: * * * * completed release+asserts Build

6) Install the compiled LLVM

Make install

will be installed in the/usr/local/bing

7) Check the version of Clang

# clang--versionclang version 3.5.0 (tags/release_350/final)

If it is an older version, you need to point/usr/bin/clang to Clang 3.5.0:

Ls-s/usr/local/bin/clang/usr/bin/clang

"RELATED LINKS"

How to install libstdc++4.7 on CentOS

Installing Python 2.7.9 on Linux CentOS 6.6

Compiling and installing Clang 3.5.0 on Linux CentOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.