Compilation of gcc4.8 recently due to work needs
We recommend that you download the GCC source code package before preparation. In this way, the GCC is also downloaded when the preparation is complete.
Wget http://mirror.bjtu.edu.cn/gnu/gcc/gcc-4.8.0/gcc-4.8.0.tar.bz2
Before installing GCC, you need to install the other three dependency packages: GMP, MPRF, and MPC.
Wget http://mirror.bjtu.edu.cn/gnu/gmp/gmp-5.1.3.tar.gz
Http://mirror.bjtu.edu.cn/gnu/mpfr/mpfr-3.1.2.tar.gz
Wget http://mirror.bjtu.edu.cn/gnu/mpc/mpc-1.0.2.tar.gz
The three packages must be installed in sequence, followed by the previous ones.
Tar-xzvf gmp-5.1.3.tar.gz
CD gmp-5.1.3
./Configure -- prefix =/usr/gmp-5.1.3
Make & make install
Tar-xzvf mpfr-3.1.2.tar.gz
CD mpfr-3.1.2
./Configure -- prefix =/usr/mpfr-3.1.2 -- With-GMP =/usr/gmp-5.1.3
Make & make install
Tar-xzvf mpc-1.0.2.tar.gz
CD mpc-1.0.2
./Configure -- prefix =/usr/mpc-1.0.2 -- With-GMP =/usr/gmp-5.1.3 -- With-mpfr =/usr/mpfr-3.1.2
Make & make install
This is the end of preparation. At this time, GCC must have been downloaded.
Tar-xjvf gcc-4.8.0.tar.bz2
Check the GCC installation instructions and find that the GCC file cannot be directly compiled in the root directory of the resource. Create a new directory in the resource and directory to compile and install it. (For complete installation instructions, see install/configure.html or http://gcc.gnu.org/install/configure.html)
CD gcc-4.8.0
Mkdir TMP
CD TMP
.. /Configure -- prefix =/usr/gcc-4.8.0 -- With-GMP =/usr/gmp-5.1.3/-- With-mpfr =/usr/mpfr-3.1.2/-- With-MPC =/usr/mpc-1.0.2 /-- enable-threads = POSIX -- enable-packages ages = C, c ++, objc, obj-C ++, Fortran -- With-PPL -- With-cloog -- Build = i686-redhat-linux
Make & make install
Then there is a long wait.
After compilation, remember to add the system variables. If you do not want to change the original GCC, add the GCC bin directory to the beginning of the path.