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
- Yum install gcc gcc-c++ glibc-static -y
2. Download gcc 4.8.2 source code
[HTML]View Plaincopy
- 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
- CD GMP
- mkdir Build
- CD Build
- .. /configure--prefix=/usr/local/gcc/gmp-4.3.2
Su gets root permission to perform the installation
[Plain]View Plaincopy
- Make && make install
4. Installing MPFR
Go back to the gcc-4.8.2 directory to enter the MPFR directory
[HTML]View Plaincopy
- Cd.. /.. /mpfr
- mkdir Build
- CD Build
- .. /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
- Make && make install
5. Installing the MPC
Go back to the gcc-4.8.2 directory to enter the MPC directory
[Plain]View Plaincopy
- Cd.. /.. /mpc
- mkdir Build
- CD Build
- .. /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
- 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
- Cd.. /..
- mkdir Build
- CD Build
- .. /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
- Make && make install
8. Uninstall the old version
[Plain]View Plaincopy
- Yum Remove gcc
- Yum Remove gcc-c++
- UpdateDB
Link to new version
[Plain]View Plaincopy
- Cd/usr/bin
- Ln-s/USR/LOCAL/GCC/BIN/GCC GCC
- 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