CentOS6.4升级gcc5.4
服务器系统版本如下:
原装的gcc版本为4.4,已安装gcc4.8.2,现升级为gcc5.4.0
安装前请清空所有自定义的环境变量,否则会出现错误,类似于
In file included from /home/sczhuhd/install_dir/gcc-5.4.0/gcc/system.h:1104:0,
from /home/sczhuhd/install_dir/gcc-5.4.0/gcc/c-family/c-common.c:23:
/home/sczhuhd/install_dir/gcc-5.4.0/gcc/hwint.h:74:9: error: 'HOST_WIDE_INT' does not name a type
typedef HOST_WIDE_INT __gcc_host_wide_int__;
^
/home/sczhuhd/install_dir/gcc-5.4.0/gcc/hwint.h:157:33: error: expected ',' or '...' before 'x'
clz_hwi (unsigned HOST_WIDE_INT x)
清空环境变量之后,首先下载gcc源码
wget ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-5.4.0/gcc-5.4.0.tar.gz
tar zxf gcc-5.4.0.tar.gz
cd gcc-5.4.0
#下载依赖库
./contrib/download_prerequisites
cd ..
mkdir gcc_make
cd gcc_make
../gcc-5.4.0/configure --disable-multilib --enable-languages=c,c++ --prefix=/home/sczhuhd/software/
make -j24
make install