标签:gcc linux
当前环境:centos6.5_64-minimal
先安装gcc和gcc-c++
[root@localhost ~]# rpm -qa | grep gcc libgcc-4.4.7-11.el6.x86_64 [root@localhost ~]# yum install -y gcc gcc-c++ #安装gcc,gcc-c++才可以编译安装后面高版本gcc [root@localhost ~]# rpm -qa | grep gcc libgcc-4.4.7-11.el6.x86_64 gcc-4.4.7-11.el6.x86_64 gcc-c++-4.4.7-11.el6.x86_64
1.下载源码包
wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 解压: tar -jxvf gcc-4.8.2.tar.bz2
cd gcc-4.8.2 ./contrib/download_prerequisites cd ..
mkdir gcc-build-4.8.2
cd gcc-build-4.8.2 ../gcc-4.8.2/configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j4 #j4选项是make对多核处理器的优化,如果不成功请使用 make
make install
update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.8.2 40
gcc -v
标签:gcc linux
原文地址:http://xiexiaojun.blog.51cto.com/2305291/1682741