zoukankan      html  css  js  c++  java
  • Centos 6 升级 gcc g++ gfortran 到 4.8.2

    升级后查看版本为新的版本。

    但是:无法正常编译。

    Paste the steps:
    1. Easy installation Operating environment CentOS6.5
                     64bit, the original version 4.4.7, cannot support the features of C++11~, hope to upgrade to 4.8.2
                         Cannot be upgraded by yum, you need to manually download the installation package and compile
     
    1.1 Obtain and unzip the installation package        
    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         
    Of course, http://ftp.gnu.org/gnu/gcc has all gcc versions for download, the latest version is already 4.9.2.
     
     
    1.2 Download dependencies for compilation needs         
    Reference [1] said: This magic script file will help us download, configure, and install dependent libraries, which can save us a lot of time and effort.
    cd gcc-4.8.2
    ./contrib/download_prerequisites 
     
     
    1.3 Create a directory for storing compiled files         
    mkdir gcc-build-4.8.2        
    cd gcc-build-4.8.2
     
    1.4 Generate Makefile        
    ../configure -enable-checking=release -enable-languages=c,c++,fortran -disable-multilib --prefix=/usr/local/gcc-4.8.2
     
    1.5 Compile (Note: This step is very time-consuming)      
    make


    configure: error: `LDFLAGS' has changed since the previous run:
    configure:   former value:   
    configure:   current value: -static-libstdc++ -static-libgcc
    configure: error: changes in the environment can compromise the build
    configure: error: run `make distclean' and/or `rm ./config.cache' and start over
    make[2]: *** [configure-stage1-gmp] Error 1
    make[2]: Leaving directory `/home/aimin/software/gcc-4.8.2/gcc-build-4.8.2'
    make[1]: *** [stage1-bubble] Error 2
    make[1]: Leaving directory `/home/aimin/software/gcc-4.8.2/gcc-build-4.8.2'
    make: *** [all] Error 2


    sudo yum -y install glibc-devel.i686 glibc-devel


    1.6, install
    sudo make install
     
    Second, verify the installation restart, and then check the gcc version:
    gcc -v
    tries to write a C++11 feature program block tryCpp11.cc, using shared_ptr

    cp /usr/local/lib64/libstdc++.so.6.0.20 /usr/lib64   
    rm -rf /usr/lib64/libstdc++.so.6  
    ln -s /usr/lib64/libstdc++.so.6.0.20 /usr/lib64/libstdc++.so.6  
    strings /usr/lib64/libstdc++.so.6 | grep GLIBC                      

    如果发现版本没有变化,

    可以删除旧版本的gcc,如果旧版的是用yum安装的,可以使用 yum remove gcc

    然后把新安装的gcc的bin目录(/usr/local/gcc-4.8.2/bin)添加到环境变量(PATH)中,/etc/profile 文件中。  

    让/etc/profile文件修改后立即生效 ,可以使用如下命令:
    source /etc/profile       
           
    gcc --version
    g++ --version
    gfortran --version      

  • 相关阅读:
    osgi实战学习之路:8. Service-3之ServiceTracker
    使用Jquery+EasyUI 进行框架项目开发案例解说之二---用户管理源代码分享
    QQ音乐产品经理黄楚雄:产品与用户的情感联系
    AsyncTask简单入门
    晨跑感悟:三快三爽三熬
    【cocos2d-x制作别踩白块儿】第九期:游戏计时功能(附源代码)
    cocos2d3.0 Scale9Sprite
    新的历程-近两个月的工作总结
    基因突变的实例:加拿大无毛猫
    ANTS Performance Profiler 破解使用
  • 原文地址:https://www.cnblogs.com/emanlee/p/13917547.html
Copyright © 2011-2022 走看看