Download the GCC source code to the GNU Open Source website and view the compilation tutorial
GNU/GCC Website: http://www.gnu.org/software/gcc/
2. According to the official website tutorial, compiling GCC's required environment depends on M4,GMP,MFPR,MPC
GNU multiple Precision Library (GMP) version 4.3.2 (or later)
necessary to build GCC. If a GMP source distribution is found in asubdirectory of your GCC sources named gmp , it'll be builttogether with GCC. Alternatively, if GMP is already installed and itis not in your library search path, you'll have the --with-gmpConfigure option. See also --with-gmp-lib and --with-gmp-include .
MPFR Library version 2.4.2 (or later)
necessary to build GCC. It can be downloaded fromhttp://www.mpfr.org/. If an MPFR source distribution is FoundIn a subdirectory of your GCC sources named mpfr , it'll bebuilt together with GC C. Alternatively, if MPFR is already installedbut it's not in your default library search path, the --with-mpfr configure Optio n should be used. See also --with-mpfr-lib and --with-mpfr-include .
MPC Library version 0.8.1 (or later)
-
Necessary to build GCC. it can is downloaded fromhttp://www.multiprecision.org/. if an MPC source Distr Ibutionis found in a subdirectory of your GCC sources named MPC , Itwill is built to Gether with GCC. alternatively, if MPC is alreadyinstalled but it's not in your default library search path, the --WITH-MPC Configure option should be used. see also --with-mpc-lib and -- With-mpc-include .
--------from https://gcc.gnu.org/install/prerequisites.html
3. The above dependency package, also the GNU project, can be found on the GNU website
http://www.gnu.org/software/m4/
http://www.gnu.org/software/gmp/
http://www.gnu.org/software/mpfr/
http://www.gnu.org/software/mpc/
4. Sequentially
Extract
Tar xjf XXX.tar.bz2
./configure
Make
sudo make install
5. Compiling GCC
Extracting GCC source code
Create Gcc-build
.. /gcc-5.3.0/configure
Setting environment variables Export ld_library_path= $LD _library_path:/usr/local/lib
Make
sudo make install
6. Success
/usr/local/bin/gcc-v
7. Problems encountered:
Issue 1:cannot compute suffix of object Files:cannot compile
Configure the environment variable, or the path is incorrect
Solution: Export ld_library_path= $LD _library_path:/usr/local/lib
Compiling gcc in a ubuntu14.04 environment