A concise process for compiling GCC 4.8.1 in CentOS 6

Source: Internet
Author: User
Tags gmp

I have discussed a lot of gcc compilation issues, all of which come from compiling gcc4.7.2 on CentOS6.2.

Today, we need to use CentOS again. For gcc, we only use the stricter open-source protocol GPL v3. The latest gcc version officially provided by CentOS can only reach 4.4, and new features must be used, you must manually compile the new version of gcc.

After several years of learning and accumulation, this morning, I easily compiled gcc on the demon centos.

In terms of knowledge and the meaning of configuration options, I have repeatedly introduced the compilation of gcc in my previous articles. Here I will mainly discuss the operation steps.

Refer:

My system is CentOS 6.4 64-bit.

Reminder: We recommend that you allocate more than 10 Gb of hard disk space. Otherwise, insufficient disk space may occur during compilation.


Compilation steps
1. Install gcc, g ++

Yum install gcc g ++

2. Install static glibc

Yum install glibc-static

3. Install cloog and gmp (because isl needs to be compiled manually)

Yum install cloog-ppl gmp-devel

4. Download and compile isl

(CentOS has not mentioned the rpm package and needs to be downloaded manually. In addition, it is not a gnu Project, for convenience, you can directly find the ftp://gcc.gnu.org/pub/gcc/infrastructure/ in the official resources of gcc)

Wget ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.11.1.tar.bz2

Tar xfj isl-0.11.1.tar.bz2

Cd isl-0.11.1

./Configure

Make

Make install

5. Download and decompress gcc to create a temporary directory for compilation.

Assume that the current directory is downloaded. The file name is gcc-4.8.1.tar.bz2.

Tar xfj gcc-4.8.1.tar.bz2

Cd gcc-4.8.1

Mkdir build

5. Download the gmp, mpfr, and MCM source code.

You can use the built-in script with one click.

./Contrib/download_prerequisites

In fact, the gmp package can not be downloaded; the other three projects are gnu, and all the gnu images are provided for download. If the download is slow on the official website, you can modify the script to a domestic image, in addition, you need to change the version number to the new version number in a specific project, because the download_prerequisites script has the lowest requirements by default, and some maintenance parties of earlier versions have not mentioned download_prerequisites.

6. Configure gcc compilation options

Cd build

../Configure -- prefix =/usr -- enable-versions ages = c, c ++ -- disable-multilib

We do not recommend that you add "-- program-suffix =-4.8.1", and then configure the connection to coexist the two versions of gcc.

7. Compile and install

Make-j4

Make install

After compilation
In CentOS,/usr/bin/gcc is different from Ubuntu. The former is an executable binary file, and the latter is a connection that connects to installed gcc versions such as gcc-4.6.3, this can be confirmed by calling ls-l.

Therefore, if you want to retain the original gcc, you must rename them and configure the connection. This operation is complicated, and the version 4.4.7 is different from version 4.6, and it is very outdated, there are no major adjustments and there is no need to retain them.

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.