CentOS Upgrade GCC to GCC4.8.2

Source: Internet
Author: User
Tags gmp

The GCC version installed on the server is too old to meet the needs of the individual version, so it is decided to upgrade the operation. Upgrade from current version 3.4.6 to 4.8.2, restricted by permissions, can only be installed to the personal designated directory, so if your server can connect to the extranet, and have root or sudo permissions, you can use the Self-service installation Services, you can skip this article, save valuable time.


The so-called "工欲善其事 its prerequisite", in the limited access, and can not connect to the outside network situation, the operation of Linux installation is really egg pain, can not, trouble to trouble, the result is good.

Prepare the GCC compression pack gcc-4.8.2.tar.gz (around 105MB) and no longer verbose, enter the topic:

1. To view the system environment and GCC version, execute the command:

$LSB _realease-a

$GCC-V

2, decompression gcc-4.8.2.tar.gz to the current directory

$tar-ZVXF gcc-4.8.2.tar.gz

3. Enter the GCC directory to view the dependent files required for compilation

$CD gcc-4.8.2/

$vim./contrib/download_prerequisites


4, according to the above address, respectively download MPFR/GMP/MPC three files, and unzip the installation. Since the MPC relies on MPFR and GMP,MPFR relies on GMP, the installation order is GMP, MPFR, MPC.

gmp-4.3.2.tar.bz2

mpfr-2.4.2.tar.bz2

Mpc-0.8.1.tar.gz

5. Compile and install GMP

$tar-JVXF ~/gmp-4.3.2.tar.bz2

$CD gmp-4.3.2

$./configure--prefix=~ /gcclib/gmp432 (Custom configuration path)

$make && make Install

6. Compile and install MPFR

$tar-JXVF ~/mpfr-2.4.2.tar.bz2

$CD mpfr-2.4.2/

$./configure--prefix=~/gcclib/mpfr242--with-gmp=~/gcclib/gmp432/(dependent on GMP)

$make && make Install

7. Compile and install MPC

$tar-ZXVF ~/mpc-0.8.1.tar.gz

$CD MPC-0.8.1/

$./configure--prefix=~/gcclib/mpc081--with-gmp=~/gcclib/gmp432/--with-mpfr=~/gcclib/mpfr242/(relies on GMP and MPFR)

$make && make Install

8. Compile and install GCC

$tar-ZVXF ~/gcc-4.8.2.tar.gz

$CD gcc-4.8.2

$./configure--prefix=~/gcc482--enable-threads=posix--disable-checking--disable-multilib--enable-languages=c,c+ +--with-gmp=~/gcclib/gmp432/--with-mpfr=~/gcclib/mpfr242/--with-mpc=~/gcclib/mpc081/(note never spell mistakes, I eat a lot of losses in this, resulting in a lot of wasted time, spelling mistakes, will report all kinds of errors, and then solve the problem, and repeatedly, finally found that their parameters written wrong, such as "Multilib" mistakenly written "Mutilib",--Enable and--disable parameters you follow my writing, Yes, the following--with specify your own path)

$ If you feel you can execute "make" command at this time, then you will be very painful, by default, all Lib shared libraries will be placed in the system directory such as 64-bit/usr/lib64/, and we manually specify the form of the directory, the system is not found when compiling the build, This means that GCC cannot find the three Lib libraries we installed before, so we do this, and we can create a global temporary path even if we don't have permission.

$export Ld_library_path= $LD _library_path:~/gcclib/gmp432/lib:~/gcclib/mpfr242/lib:~/gcclib/mpc081/ LIB (ensure that the original parameters are correct, plus a new shared path, separated by a colon)

$make (Don't be silly to wait in front of the screen, listen to the elder brother to persuade, this process of time you can enjoy a Hollywood blockbuster, at least 1.5 hours, of course, if your server is not super fast please ignore)

$make Install

$~/gcc482/bin/gcc-v (check the installation version to verify that the installation is successful)

9, complete!


During the installation process, there are not fewer than 10 wonderful problems, there is no record, because there is no original image, persuasion is not enough, and records are more troublesome, so If you encounter any problems during the installation process, take a closer look at the error prompt, Google, it is easy to solve, of course, you are welcome to leave a message, is happy to help you solve.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

CentOS Upgrade GCC to GCC4.8.2

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.