Never upgraded GCC before, with the system's default version of GCC, recently in the study for a long time no use of C, there will be upgraded GCC want to send, roughly as follows.
Environment: CENTOS-6.5-I386, the gcc-4.4.7 system must already have a compiler installed, because GCC is also required to compile the
First, GCC compilation requires three additional libraries to download and install them in the following order:
1. GMP FTP://FTP.GNU.ORG/GNU/GMP
2. MPFR FTP://FTP.GNU.ORG/GNU/MPFR
3. MPC HTTP://WWW.MULTIPRECISION.ORG/MPC
1. Compile and install GMP
# TAR-ZXVF Gmp-5.1.3.tar.gz
# CD gmp-5.1.3
#./configure
# Make && make install
2. Compile and install MPFR
# TAR-ZXVF Mpfr-3.1.2.tar.gz
# CD mpfr-3.1.2
#./configure
# Make && make install
3. Compile and install the MPC
# TAR-ZXVF Mpc-1.0.tar.gz
# CD mpc-1.0
#./configure
# Make && make install
4. Copy or make a soft link to the following dynamic link library file under/lib, because there may not be a shared library file for the above three dependent libraries when you compile and install GCC
/usr/local/lib/libmpc.so
/usr/local/lib/libmpc.so.3
/usr/local/lib/libmpfr.so
/usr/local/lib/libmpfr.so.4
/usr/local/lib/libgmp.so
/usr/local/lib/libgmp.so.10
4. Compile and install GCC
GCC Compilation Parameters Description:
--prefix//default GCC installation directory, CentOS-6.5 under the best installation to/usr below, otherwise there may be a problem
--enable-languages//Specifies which languages the GCC can compile, each language separated by commas, such as C,c++,java
--disable-multilib//default GCC compiles code into a 64-bit program on a 32-bit system, or a 32-bit program on a 64-bit system, and if you add this compilation option, turns off this GCC's cross-compilation feature.
# TAR-ZXVF Gcc-4.8.2.tar.gz
# CD gcc-4.8.2
# mkdir Build
# CD Build
# .. /configure--PREFIX=/USR
# Make && make install
Note: when the GMP, MPFR, MPC is compiled to customize the specified installation path, you need to add the following options when compiling GCC:
--WITH-MPC=MPC installation directory
--WITH-MPFR=MPFR install directory
--with-gmp=gmp installation directory