• CENTOS 6 通过YUM升级GCC到4.7/4.8


    第一阶段:升级到4.7

    [root@01314.CN ~]# cd /etc/yum.repos.d
    [root@01314.CN yum.repos.d]# wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo 
    [root@01314.CN yum.repos.d]# yum --enablerepo=testing-1.1-devtools-6 install devtoolset-1.1-gcc devtoolset-1.1-gcc-c++

    安装文件放置位置在:/opt/centos/devtoolset-1.1
    具体程序文件位置在:/opt/centos/devtoolset-1.1/root/usr/bin/*

    使用最新的gcc环境,所以要替换本地的,使用软连接来完成(也可以设置环境变量,看自己喜好)

    [root@01314.CN ~]# mv /usr/bin/gcc /usr/bin/gcc-4.4.7
    [root@01314.CN ~]# mv /usr/bin/g++ /usr/bin/g++-4.4.7
    [root@01314.CN ~]# mv /usr/bin/c++ /usr/bin/c++-4.4.7
    [root@01314.CN ~]# ln -s /opt/centos/devtoolset-1.1/root/usr/bin/gcc /usr/bin/gcc
    [root@01314.CN ~]# ln -s /opt/centos/devtoolset-1.1/root/usr/bin/c++ /usr/bin/c++
    [root@01314.CN ~]# ln -s /opt/centos/devtoolset-1.1/root/usr/bin/g++ /usr/bin/g++
    [root@01314.CN ~]# gcc --version

    第二阶段:升级到4.8

    [root@01314.CN ~]# cd /etc/yum.repos.d
    [root@01314.CN yum.repos.d]# wget http://people.centos.org/tru/devtools-2/devtools-2.repo
    [root@01314.CN yum.repos.d]# yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++

    安装文件放置位置在:/opt/rh/devtoolset-2
    具体程序文件位置在:/opt/rh/devtoolset-2/root/usr/bin/*

    使用最新的gcc环境,所以要替换本地的,使用软连接来完成(也可以设置环境变量,看自己喜好)

    [root@01314.CN ~]# mv /usr/bin/gcc /usr/bin/gcc-4.4.7
    [root@01314.CN ~]# mv /usr/bin/g++ /usr/bin/g++-4.4.7
    [root@01314.CN ~]# mv /usr/bin/c++ /usr/bin/c++-4.4.7
    [root@01314.CN ~]# ln -s /opt/rh/devtoolset-2/root/usr/bin/gcc /usr/bin/gcc
    [root@01314.CN ~]# ln -s /opt/rh/devtoolset-2/root/usr/bin/c++ /usr/bin/c++
    [root@01314.CN ~]# ln -s /opt/rh/devtoolset-2/root/usr/bin/g++ /usr/bin/g++
    
    [root@01314.CN ~]# gcc --version
    gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
    Copyright (C) 2013 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  • 相关阅读:
    HDU5029--Relief grain (树链剖分+线段树 )
    codeforces 277.5 div2 F:组合计数类dp
    FZU2176---easy problem (树链剖分)
    Codeforces Round #277.5 (Div. 2) --E. Hiking (01分数规划)
    FZU 11月月赛D题:双向搜索+二分
    POJ
    POJ
    HDU 4746 Mophues(莫比乌斯反演)
    BZOJ 2005 能量采集 (莫比乌斯反演)
    BZOJ 2301 Problem b (莫比乌斯反演+容斥)
  • 原文地址:https://www.cnblogs.com/youlechang123/p/6422267.html
Copyright © 2020-2023  润新知