CentOS 6.4 Compilation Install GCC 4.8.1

Source: Internet
Author: User
Tags gmp

I was very excited to see "GCC 4.8.1 Released, c++11 feature Complete" on Isocpp today. Finally, there is a compiler that fully supports C++11 language features!

Of course, GCC is just a full-fledged support for language features c++11,libstdc++ seems to have not completely followed, but I have been satisfied, at least to try a variety of features. In addition, there has been a message that clang function also 100% support C++11, but the internal test, Clang3.3 release version is said to be released June 5, recently for C + + is really a lot ah, very much looking forward!

This afternoon to see the news, the evening is really unbearable, hurriedly the latest gcc download down to compile and install, the following describes the following installation steps:

Before the installation, or remind everyone: some basic preparation work I will not say, such as to install a Linux (Centos,ubuntu, etc.), and then install the basic compilation environment, with the older compilation environment to compile a new compiler, which is called Bootstrap (Bootstrap). If the process of compiling, prompt error, follow the prompts to install the environment, no longer detailed description.

1. Download gcc 4.8.1 Source package:

http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.bz2

I am installed in the virtual machine Linux, I think wget too slow, so I am on the windows with Thunder Good, and then share to Linux.

2, Decompression:

TAR-JXVF gcc-4.8.1.tar.bz2

3. Download the dependent packages required for compilation:

This step is done in two ways:

A) If Linux has an Internet connection, just like this:

CD gcc-4.8.1

./contrib/download_prerequisites

Cd..

b) If Linux does not have a network connection (my host and virtual machine is host-only, can not be networked, so another way), then use Windows Internet download these several packages:

ftp://ftp.gnu.org/gnu/gmp/gmp-4.3.2.tar.bz2

http://www.mpfr.org/mpfr-2.4.2/mpfr-2.4.2.tar.bz2

Http://www.multiprecision.org/mpc/download/mpc-0.8.1.tar.gz

Someone asked, do you have to download several versions? Download the latest version of the line? I have not tried, I do not know, I follow the gcc-4.8.1/contrib/download_prerequisites script in the version of the download. Since the inside has already said these several versions, then I will strictly follow its request to do.

Then unzip and move to the gcc-4.8.1 below:

TAR-XJF gmp-4.3.2.tar.bz2

TAR-XJF mpfr-2.4.2.tar.bz2

Tar-xzf mpc-0.8.1.tar.gz

MV gmp-4.3.2 GCC-4.8.1/GMP

MV mpfr-2.4.2 GCC-4.8.1/MPFR

MV mpc-0.8.1 GCC-4.8.1/MPC

The advantage of this is that you do not have to compile the GMP, MPFR, and MPC three packages separately, put them together under the GCC source code (in fact, this is also the practice of Gcc-4.8.1/contrib/download_prerequisites script, the personal feel more concise).

4. The new directory is used to store the compilation result:

mkdir gcc-build-4.8.1

5. Enter the new directory and execute the Configure command to generate the makefile:

CD gcc-build-4.8.1

.. /gcc-4.8.1/configure--enable-checking=release--enable-languages=c,c++--disable-multilib

The specific options do not explain much, you can see for yourself, I only use C and C + +, so only compile the compiler for both languages.

6. Compiling:

Make-j4

I am i5 four core, so open 4 threads compile at the same time, if there is 8 core is more cool ~ I spent 30 minutes in the virtual machine time, not too slow.

7. Installation:

sudo make install

8, finished, check the version:

g++--version

g++ (GCC) 4.8.1
Copyright (C) Free Software Foundation, Inc.
This was free software; See the source for copying conditions. There is NO
Warranty Not even to merchantability or FITNESS for A particular PURPOSE.

"Reference article":

Http://rritw.com/a/caozuoxitong/OS/20130407/335815.html

http://www.lainme.com/doku.php/blog/2012/06/%E5%9C%A8centos_5%E4%B8%8A%E7%BC%96%E8%AF%91gcc_4.7

Http://www.cnblogs.com/chuncn/archive/2010/10/15/1851853.html

http://blog.csdn.net/bokee/article/details/5380044

CentOS 6.4 Compilation Install GCC 4.8.1

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.