CentOS GCC Upgrade 4.8 steps

Source: Internet
Author: User

Recently you need to use c++11, so you need to upgrade GCC from 4.4.7 to 4.8.1.

First we need to download the GCC source

wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.1/gcc-4.8.1.tar.gz

Then unzip into the directory

Tar-xvzf gcc-4.8.1.tar.gz-c/OPT/GCC
cd/opt/gcc/gcc-4.8.1

Execute the following command:

./contrib/download_prerequisites

Then create the compilation directory in the gcc-4.8.1 peer directory

CD..
mkdir build_gcc_4.8.1


The next step is to execute the compilation

CD build_gcc_4.8.1
... /gcc-4.8.1/configure--enable-checking=release--enable-languages=c,c++--disable-multilib  
make-j4
make Install

If you do not encounter error while executing make and make install, congratulations, you have completed the gcc-4.8.1 installation.

The default installation path is:

/usr/local/bin

The next step is to upgrade the version.

/usr/sbin/update-alternatives--install  /USR/BIN/GCC gcc/usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.8.1 40


/usr/sbin/update-alternatives--install/usr/bin/g++ g++/usr/local/bin/g++ 40

Check your server's GCC version again to see that it has been updated to 4.8.1


But in fact in make and makes install process, more or less will encounter some inexplicable problems.

The problem I had was that I made a mistake in make, and I doubted if I had a problem with the installation package I downloaded.

Later, after you have made clean and deleted all of the build files, you're done again.

The only difference between the first failure and the second success is:

The second gcc-4.8.1 decompression is placed in the/opt/gcc/directory, followed by the build_gcc-4.8.1 is placed in the/OPT/GCC directory.

And the first time, decompression source gcc-4.8.1 and subsequent build_gcc-4.8.1 are placed in the/opt/root directory.





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.