zoukankan      html  css  js  c++  java
  • CentOS7 升级gcc版本

      CentOS7自带的GCC版本是4.8.5,如下所示:

    # cat /etc/redhat-release 
    CentOS Linux release 7.6.1810 (Core) 
    # which gcc
    # gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
    Thread model: posix
    gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
    

      在一些使用场景下需要高版本的GCC编译器,网上有介绍的下载源码编译,但个人在编译的时候老是会出一些问题,而且编译过程较为冗长,现简单copy stackoverflow上的回答。

    sudo yum install centos-release-scl
    sudo yum install devtoolset-7-gcc*
    scl enable devtoolset-7 bash
    which gcc
    gcc --version
    # scl enable devtoolset-7 bash     # bash生效
    # which gcc
    /opt/rh/devtoolset-7/root/usr/bin/gcc
    # gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-7/root/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper
    Target: x86_64-redhat-linux
    Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-7/root/usr --mandir=/opt/rh/devtoolset-7/root/usr/share/man --infodir=/opt/rh/devtoolset-7/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --with-default-libstdcxx-abi=gcc4-compatible --with-isl=/builddir/build/BUILD/gcc-7.3.1-20180303/obj-x86_64-redhat-linux/isl-install --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
    Thread model: posix
    gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC) 

      升级成功!

  • 相关阅读:
    vue+antDesign 多个select下拉组件实现已选择项不可用(置灰)
    antd + vue 点击编辑文本切换成可编辑状态(附下拉框)
    antDesign的table组件设置行列样式
    jQuery 效果之显示隐藏
    jQuery 样式操作
    jQuery对象筛选选择器
    jQuery 和DOM对象互相转化方法
    JQuery-01-1
    常见网页特效
    WebApl-javescript-动画函数
  • 原文地址:https://www.cnblogs.com/Hi-blog/p/How-To-Update-Gcc-On-CentOS7.html
Copyright © 2011-2022 走看看