1. GCC Source code Download
ftp://gcc.gnu.org/pub/gcc/releases/
[[Email protected] ~] wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.gz[[email protected] ~] Tar zxvf Gcc-8.2.0.tar.gz
Download the GCC version you need.
2. Download the GCC dependent Library source code
GMP FTP://GCC.GNU.ORG/PUB/GCC/INFRASTRUCTURE/GMP-6.1.0.TAR.BZ2
MPC ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
MPFR ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
[[email protected] ~] wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 ftp://gcc.gnu.org/pub/ Gcc/infrastructure/mpc-1.0.3.tar.gz ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2[[email Protected] ~] Tar jxvf gmp-6.1.0.tar.bz2[[email protected] ~] Tar zxvf mpc-1.0.3.tar.gz[[email protected] ~] Tar jxvf mpfr-3.1.4.tar.bz2[[email protected] ~] CD ~/gmp-6.1.0[[email protected] ~./configure--prefix=/ Usr/local/gmp[[email protected] ~] Make && make install[[email protected] ~] CD ~/mpc-1.0.3[[email& Nbsp;protected] ~]./configure--prefix=/usr/local/mpc[[email protected] ~] Make && make install[[email& Nbsp;protected] ~] CD ~/mpfr-3.1.4[[email protected] ~]./configure--prefix=/usr/local/mpfr[[email Protected] ~ [Make && make install[[email protected] ~] Export ld_library_path= $LD _library_path:/usr/ Local/mpc/lib:/usr/local/gmp/lib:/usr/local/mpfr/lib/[[email protected] ~] CD ~/Gcc-8.2.0[[email protected] ~]./configure--PREFIX=/USR/LOCAL/GCC--with-gmp=/usr/local/gmp/--with-mpfr=/usr /local/mpfr/--with-mpc=/usr/local/mpc/--with-system-zlib--disable-multilib[[email protected] ~] Make & & Make Install
3. Note
make encountered:
checking for suffix of object files... configure: error: in '/home/yhwang/gcc-8.2/ GCC-8.2.0/X86_64-LINUX-GNU/LIBGCC ':
configure: error: cannot compute suffix of object files: cannot compile
see ' Config.log ' for more details.
make[2]: *** [configure-stage1-target-libgcc] error 1
make[2]: Leaving directory '/home/yhwang/gcc-8.2/gcc-8.2.0 '
make[1]: *** [stage1-bubble] error 2
make[1]: Leaving directory '/home/yhwang/gcc-8.2/gcc-8.2.0 '
make: *** [all] Error 2
And then you stop, you need to enter the following statement before compiling
[[Email protected] ~] Export ld_library_path= $LD _library_path:/usr/local/mpc/lib:/usr/local/gmp/lib:/usr/local/ mpfr/lib/
And then
[[Email protected] ~] Make && make install
4. Check the GCC version
[[Email protected] ~] Gcc-v[[email protected] ~] g++-V
GCC Source code compilation