gcc 更新

1 minute read

背景

下载新版本

https://gcc.gnu.org/mirrors.html

解压

#tar -xvzf gcc-4.9.3.tar.gz  
#cd gcc-4.9.3  

下载依赖包

./contrib/download_prerequisites  

安装依赖包

cd contrib  
drwxr-xr-x 16 digoal users    4096 Jan 12 17:11 gmp-4.3.2  
drwxr-xr-x  7 digoal users   20480 Jan 12 17:14 mpfr-2.4.2  
drwxr-xr-x  5 digoal users    4096 Jan 12 17:15 mpc-0.8.1  
drwxr-xr-x  9 digoal users   20480 Jan 12 17:18 isl-0.12.2  
drwxr-xr-x 15 digoal users    4096 Jan 12 17:20 cloog-0.18.1  
  
cd  
tar -jxvf gmp-4.3.2.tar.bz2   
cd gmp-4.3.2  
./configure --prefix=/home/digoal/gmp  
make -j 32 && make install  
cd ..  
  
tar -jxvf mpfr-2.4.2.tar.bz2  
cd mpfr-2.4.2  
./configure --prefix=/home/digoal/mpfr --with-gmp-include=/home/digoal/gmp/include --with-gmp-lib=/home/digoal/gmp/lib  
make -j 32 && make install  
cd ..  
  
tar -zxvf mpc-0.8.1.tar.gz   
cd mpc-0.8.1  
./configure --prefix=/home/digoal/mpc --with-gmp=/home/digoal/gmp --with-mpfr=/home/digoal/mpfr  
make -j 32 && make install  
cd ..  
  
tar -jxvf isl-0.12.2.tar.bz2   
cd isl-0.12.2  
./configure --prefix=/home/digoal/isl --with-gmp-prefix=/home/digoal/gmp  
make -j 32 && make install -j 32  
cd ..  
  
tar -zxvf cloog-0.18.1.tar.gz   
cd cloog-0.18.1  
./configure --prefix=/home/digoal/cloog --with-isl-prefix=/home/digoal/isl --with-gmp-prefix=/home/digoal/gmp  
make && make install  
cd ..  
  
tar -jxvf gcc-4.9.3.tar.bz2  
cd gcc-4.9.3.tar  
./configure --prefix=/home/digoal/gcc4.9.3 --with-mpc=/home/digoal/mpc --with-mpfr=/home/digoal/mpfr --with-gmp=/home/digoal/gmp --with-cloog=/home/digoal/cloog --with-isl=/home/digoal/isl --disable-multilib --disable-isl-version-check  
make -j 32 && make install -j 32  
cd ..  

编译gcc

#export LD_LIBRARY_PATH=/u02/digoal/cloog/lib:/u02/digoal/gmp/lib:/u02/digoal/isl/lib:/u02/digoal/mpc/lib:/u02/digoal/mpfr/lib:$LD_LIBRARY_PATH  
  
#./configure --prefix=/u02/digoal/gcc4.9.3 --with-mpc=/u02/digoal/mpc --with-mpfr=/u02/digoal/mpfr --with-gmp=/u02/digoal/gmp --with-cloog=/u02/digoal/cloog --with-isl=/u02/digoal/isl --disable-isl-version-check --disable-multilib --disable-libatomic  
  
make -j 32  
make install -j 32  

将环境变量加入/etc/profile

export LD_LIBRARY_PATH=/u02/digoal/gcc4.9.3/lib:/u02/digoal/cloog/lib:/u02/digoal/gmp/lib:/u02/digoal/isl/lib:/u02/digoal/mpc/lib:/u02/digoal/mpfr/lib:$LD_LIBRARY_PATH  
export PATH=/u02/digoal/gcc4.9.3/bin:$PATH  

修改ld.so.conf

# vi /etc/ld.so.conf  
/u02/digoal/gcc4.9.3/lib  
/u02/digoal/cloog/lib  
/u02/digoal/gmp/lib  
/u02/digoal/isl/lib  
/u02/digoal/mpc/lib  
u02/digoal/mpfr/lib  
  
# ldconfig  

参考

1. https://gcc.gnu.org/install/prerequisites.html

Flag Counter

digoal’s 大量PostgreSQL文章入口