gcc 4.5.0编译安装

suse 10u2自带的gcc版本过低,OpenFOAM推荐gcc 4.4(4.3也行)。因此需要首先升级gcc。以下为流水账。
1.下载
wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
wget -c ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.5.0/gcc-4.5.0.tar.gz
wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
wget -c ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
2.安装gmp
b63:/public/soucecode/gcc # tar xjvf gmp-4.3.2.tar.bz2
b63:/public/soucecode/gcc # cd gmp-4.3.2/
b63:/public/soucecode/gcc/gmp-4.3.2 # ./configure –prefix=/usr/local/gmp-4.3.2
b63:/public/soucecode/gcc/gmp-4.3.2 # make -j8
b63:/public/soucecode/gcc/gmp-4.3.2 # make install
3.安装mpfr
b63:/public/soucecode/gcc # tar xjvf mpfr-2.4.2.tar.bz2
b63:/public/soucecode/gcc # cd mpfr-2.4.2/
b63:/public/soucecode/gcc/mpfr-2.4.2 # ./configure –prefix=/usr/local/mpfr-2.4.2/ –with-gmp=/usr/local/gmp-4.3.2/
b63:/public/soucecode/gcc/mpfr-2.4.2 # make -j8
b63:/public/soucecode/gcc/mpfr-2.4.2 # make install
4.安装mpc
b63:/public/soucecode/gcc # tar zxvf mpc-0.8.1.tar.gz
b63:/public/soucecode/gcc # cd mpc-0.8.1/
b63:/public/soucecode/gcc/mpc-0.8.1 # ./configure –prefix=/usr/local/mpc-0.8.1 –with-gmp=/usr/local/gmp-4.3.2/ –with-mpfr=/usr/local/mpfr-2.4.2/
b63:/public/soucecode/gcc/mpc-0.8.1 # make -j8
b63:/public/soucecode/gcc/mpc-0.8.1 # make install
5.安装gcc 4.5.0
b63:/public/soucecode/gcc # tar zxvf gcc-4.5.0.tar.gz
b63:/public/soucecode/gcc # cd gcc-4.5.0/
b63:/public/soucecode/gcc/gcc-4.5.0 # ./configure –prefix=/usr/local/gcc-4.5.0 –enable-shared –enable-threads=posix –enable-languages=c,c++,objc,obj-c++ –with-gmp=/usr/local/gmp-4.3.2/ –with-mpfr=/usr/local/mpfr-2.4.2/ –with-mpc=/usr/local/mpc-0.8.1/
b63:/public/soucecode/gcc/gcc-4.5.0 # make -j8
b63:/public/soucecode/gcc/gcc-4.5.0 # make install
至此基本上可以结束了。

 

————————————————————–分割线————————————————————–
问题:configue gcc时出现以下错误:
configure: error: cannot compute suffix of object files: cannot compile
解决办法:export LD_LIBRARY_PATH=/usr/local/gmp-4.3.2/lib:/usr/local/mpc-0.8.1/lib:/usr/local/mpfr-2.4.2/lib:$LD_LIBRARY_PATH
此条目发表在HPC分类目录,贴了, , 标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。

验证图片

*