CentOS6.5 gcc-4.8.2 Installation Steps

Source: Internet
Author: User
Tags gmp

Reprinted from: http://blog.sina.com.cn/s/blog_627b3f930101hnz8.html

Thanks a lot, Trig_yao .

The CentOS6.5 comes with a gcc version of 4.4.7, some years, some new software to use the library did not, the latest GCC 4.8.2 has been released, so download the source code installed a try.

1. First install the old GCC-related compilation tools

[JavaScript]View Plaincopy
    1. Yum install gcc gcc-c++ glibc-static -y


2. Download gcc 4.8.2 source code

[HTML]View Plaincopy
    1. wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.2/gcc-4.8.2.tar.bz2


Unzip the source code package, enter the gcc-4.8.2 directory, execute the./contrib/download_prerequisities script automatically downloads three dependent libraries for gmp-4.3.2, mpfr-2.4.2, mpc-0.8.1, you can also download the installation offline via the following address:

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

If a dependent library is automatically downloaded through a script, the GMP, MPFR, and MPC three directories are generated in the gcc-4.8.2 directory, which can be installed separately

3. Installation of GMP

[Plain]View Plaincopy
    1. CD GMP
    2. mkdir Build
    3. CD Build
    4. .. /configure--prefix=/usr/local/gcc/gmp-4.3.2


Su gets root permission to perform the installation

[Plain]View Plaincopy
    1. Make && make install

4. Installing MPFR

Go back to the gcc-4.8.2 directory to enter the MPFR directory

[HTML]View Plaincopy
    1. Cd.. /.. /mpfr
    2. mkdir Build
    3. CD Build
    4. .. /configure--prefix=/usr/local/gcc/mpfr-2.4.2--with-gmp=/usr/local/gcc/gmp-4.3.2


Su gets root permission to perform the installation

[Plain]View Plaincopy
    1. Make && make install


5. Installing the MPC

Go back to the gcc-4.8.2 directory to enter the MPC directory

[Plain]View Plaincopy
    1. Cd.. /.. /mpc
    2. mkdir Build
    3. CD Build
    4. .. /configure--prefix=/usr/local/gcc/mpc-0.8.1--with-mpfr=/usr/local/gcc/mpfr-2.4.2--with-gmp=/usr/local/gcc/ gmp-4.3.2


Su gets root permission to perform the installation

[Plain]View Plaincopy
    1. Make && make install


6. Add the shared library path, su to root edit ld.so.conf file, add the following content to the file:

/usr/local/gcc/gmp-4.3.2/lib
/usr/local/gcc/mpfr-2.4.2/lib
/usr/local/gcc/mpc-0.8.1/lib

Save exit, execute Ldconfig command

7. Compiling GCC4.8.2

[HTML]View Plaincopy
    1. Cd.. /..
    2. mkdir Build
    3. CD Build
    4. .. /configure--PREFIX=/USR/LOCAL/GCC--enable-threads=posix--disable-checking--enable-languages=c,c++-- Disable-multilib


Change root, execute make && make install, start a long wait ...

[HTML]View Plaincopy
    1. Make && make install


8. Uninstall the old version

[Plain]View Plaincopy
    1. Yum Remove gcc
    2. Yum Remove gcc-c++
    3. UpdateDB


Link to new version

[Plain]View Plaincopy
    1. Cd/usr/bin
    2. Ln-s/USR/LOCAL/GCC/BIN/GCC GCC
    3. Ln-s/usr/local/gcc/bin/g++ g++


Add Man Help

Vi/etc/man.config

Add GCC's man path to the configuration file

Manpath/usr/local/gcc/share/man

Save quit to take effect, use man gcc to view Help

CentOS6.5 gcc-4.8.2 Installation Steps

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.