1. The environment is in the title
2. gcc-4.9.1 compilation and installation requires the system to have a set of GCC/g ++
3. Use Yum to install gcc/g ++
1 yum install gcc2 yum install gcc-c++
4. Download gcc-4.9.1 upload server via winscp
5. Extract
1 tar xvf gcc-4.9.1.tar.gz
6. download the dependencies compiled by GCC. This step will enable automatic download. However, after downloading the dependencies on my machine, it stops, I wonder whether the download server is unstable or why it is my local network. Then I used manual download.
1 ./contrib/download_prerequisites
7. If the download_prerequisites file is not successfully downloaded, download it manually and open the download_prerequisites file in the previous step.
# Necessary to build GCC.
MPFR=mpfr-2.4.2
GMP=gmp-4.3.2
MPC=mpc-0.8.1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPFR.tar.bz2 || exit 1
tar xjf $MPFR.tar.bz2 || exit 1
ln -sf $MPFR mpfr || exit 1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$GMP.tar.bz2 || exit 1
tar xjf $GMP.tar.bz2 || exit 1
ln -sf $GMP gmp || exit 1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$MPC.tar.gz || exit 1
tar xzf $MPC.tar.gz || exit 1
ln -sf $MPC mpc || exit 1
# Necessary to build GCC with the Graphite loop optimizations.
if [ "$GRAPHITE_LOOP_OPT" = "yes" ] ; then
ISL=isl-0.12.2
CLOOG=cloog-0.18.1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$ISL.tar.bz2 || exit 1
tar xjf $ISL.tar.bz2 || exit 1
ln -sf $ISL isl || exit 1
wget ftp://gcc.gnu.org/pub/gcc/infrastructure/$CLOOG.tar.gz || exit 1
tar xzf $CLOOG.tar.gz || exit 1
ln -sf $CLOOG cloog || exit 1
fi
Download the five files manually, put the five files in the contrib directory, edit the download_prerequisites file, comment out the statements with wget, save them, and run them once.
8. Run configure
1 ./configure --prefix=/usr/gcc --enable-languages=c,c++ --disenable-multilib
9. Then make/make install to verify whether gcc-V/g ++-V has been installed successfully.