centos 6.6 安装 gcc 4.9.1

来源:互联网 发布:centos ens33 配置 编辑:程序博客网 时间:2024/05/02 11:36

不用编译,执行下面三步即可

cd /etc/yum.repos.dwget http://linuxsoft.cern.ch/cern/scl/slc6-scl.repoyum -y --nogpgcheck install devtoolset-3-gcc devtoolset-3-gcc-c++

安装到了以下目录

/opt/rh/devtoolset-3/root/usr/bin

现在建立修改原来的gcc到现在的gcc

[root@10-149-11-152 bin]# pwd/opt/rh/devtoolset-3/root/usr/bin[root@10-149-11-152 bin]# cd /usr/bin/[root@10-149-11-152 bin]# gcc --versiongcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)Copyright (C) 2010 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.[root@10-149-11-152 bin]# cp gcc gcc-4.4.7[root@10-149-11-152 bin]# c++ --versionc++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)Copyright (C) 2010 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.[root@10-149-11-152 bin]# cp c++ c++-4.4.7[root@10-149-11-152 bin]# rm gccrm: remove regular file `gcc'? y[root@10-149-11-152 bin]# rm c++rm: remove regular file `c++'? y[root@10-149-11-152 bin]# ln -s /opt/rh/devtoolset-3/root/usr/bin/gcc /usr/bin/gcc[root@10-149-11-152 bin]# ln -s /opt/rh/devtoolset-3/root/usr/bin/c++ /usr/bin/c++[root@10-149-11-152 bin]# gcc --versiongcc (GCC) 4.9.1 20140922 (Red Hat 4.9.1-10)Copyright (C) 2014 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.[root@10-149-11-152 bin]# c++ --versionc++ (GCC) 4.9.1 20140922 (Red Hat 4.9.1-10)Copyright (C) 2014 Free Software Foundation, Inc.This is free software; see the source for copying conditions.  There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


0 0
原创粉丝点击