gcc4.7.2安装

gcc4.7.2编译方法:
推荐第一种

1.简化版:
http://www.cnblogs.com/linbc/archive/2012/08/03/2621169.html
sudo yum install glibc-static libstdc++-static
wget http://ftp.gnu.org/gnu/gcc/gcc-4.7.0/gcc-4.7.0.tar.gz
tar xzf gcc-4.7.0.tar.gz 
cd gcc-4.7.0 
使用./contrib/download_prerequisites  ,他会自动下载,自动编译,何乐而不为
./contrib/download_prerequisites 
cd .. 
mkdir build_gcc4.7
cd build_gcc4.7
../gcc-4.7.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j4
sudo make install



2.全手动版
http://blog.csdn.net/gengshenghong/article/details/7498085
#install gmp
mkdir /opt/gmp-5.0.5
./configure --prefix=/opt/gmp-5.0.5
yum install m4
make && make check && sudo make install

#install mpfr
mkdir /opt/mpfr-3.1.1
./configure --prefix=/opt/mpfr-3.1.1 --with-gmp=/opt/gmp-5.0.5
make && make check && sudo make install

#install mpc
mkdir /opt/mpc-1.0
./configure --prefix=/opt/mpc-1.0 --with-gmp=/opt/gmp-5.0.5 --with-mpfr=/opt/mpfr-3.1.1
make && make check && sudo make install

#install gcc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/gmp-5.0.5/lib:/opt/mpfr-3.1.1/lib:/opt/mpc-1.0/lib
export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu && export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu
export OBJC_INCLUDE_PATH=$C_INCLUDE_PATH
sudo mkdir -p /opt/gcc-4.7
mkdir gcc_build
./configure --prefix=/opt/gcc-4.7 --with-gmp=/opt/gmp-5.0.5 --with-mpfr=/opt/mpfr-3.1.1 --with-mpc=/opt/mpc-1.0 --disable-multilib --enable-languages=c,c++,fortran,java,go
make -j8
make check -> optional

sudo ln -s /opt/mpfr-3.1.1/lib/libmpfr.so.1 /usr/lib64/libmpfr.so.1
sudo ln -s /opt/gmp-5.0.5/lib/libgmp.so.3 /usr/lib64/libgmp.so.3
export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=$C_INCLUDE_PATH
export OBJC_INCLUDE_PATH=$C_INCLUDE_PATH
export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LIBRARY_PATH


export GCCDIR=/opt/gcc-4.7
export PATH=$GCCDIR/bin:$PATH
export LD_LIBRARY_PATH=$GCCDIR/lib:$GCCDIR/lib64:/opt/gmp-5.0.5/lib:/opt/mpfr-3.1.1/lib:/opt/mpc-1.0/lib:$LD_LIBRARY_PATH
export MANPATH=$GCCDIR/share/man:$MANPATH


make install

#autogen

你可能感兴趣的:(gcc)