CentOS下编译安装Gcc-4.9

  给公司测试服务器搭环境,手工安装gcc-4.9.0颇费功夫,记录如下。

  1、安装gcc、g++,系统源默认安装版本为4.4.7;

  2、安装依赖包GMP、MPFR、MPC,注意安装顺序;

  3、修改动态库链接路径,加入GMP、MPFR、MPC;

  4、编译安装Gcc-4.9,新创建目录gcc-build来存放Make过程产生文件;

  5、拷贝Gcc-4.9的头文件至目录/usr/include/c++;

  6、修改LD_LIBRARY_PATH、PATH和CPLUS_INCLUDE_PATH,保存到/etc/profile;

  7、建立新的Gcc、G++软连接。


yum -y install gcc
yum -y install gcc-c++

mkdir /usr/local/gmp-4.3.
./configure --prefix=/usr/local/gmp-4.3./
make
make install mkdir /usr/local/mpfr-2.4.
./configure --prefix=/usr/local/mpfr-2.4. --with-gmp=/usr/local/gmp-4.3.
make
make install mkdir /usr/local/mpc-0.8.
./configure --prefix=/usr/local/mpc-0.8. --with-gmp=/usr/local/gmp-4.3. --with-mpfr=/usr/local/mpfr-2.4.
make
make install

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gmp-4.3./lib:/usr/local/mpfr-2.4./lib:/usr/local/mpc-0.8./lib

mkdir gcc-bulid
cd gcc-build
../gcc-4.9./configure --prefix=/usr/local/gcc-4.9. --exec-prefix=/usr/local/gcc --enable-languages=c,c++ --with-gmp=/usr/local/gmp-4.3. --with-mpfr=/usr/local/mpfr-2.4. --with-mpc=/usr/local/mpc-0.8. --disable-multilib
make
make install

cp -r /usr/local/gcc-4.9./include/c++/4.9. /usr/include/c++

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/gmp-4.3./lib:/usr/local/mpfr-2.4./lib:/usr/local/mpc-0.8./lib:/usr/local/gcc/lib64
export PATH=$PATH:/usr/local/gcc/bin
export CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:/usr/include/c++/4.9.:/usr/include/c++/4.9./x86_64-unknown-linux-gnu

mv gcc gcc-4.4.
ln -s /usr/local/gcc/bin/gcc ./gcc mv g++ g++-4.4.
ln -s /usr/local/gcc/bin/g++ g++
上一篇:SQLSERVER 中实现类似Mysql的 INSERT ON DUPLICATE KEY UPDATE


下一篇:【spark】dataframe常见操作