How to install gcc8 using devtoolset-8-gcc

前端 未结 3 2158
走了就别回头了
走了就别回头了 2021-02-15 11:01

I am using CentOS Linux release 7.3.1611 which has gcc 4.8.5 20150623 installed. I am looking for a way to install a newer version of gcc, specially 8.1. I found the following

相关标签:
3条回答
  • 2021-02-15 11:35

    devtoolset-8 was only released a short while ago. The linked installation instructions may be of use. However, your question pertains to CentOS, and this does not yet appear to have been made available yet. You can see some evidence of it being build for CentOS here, but it's not been updated for the final release yet.

    You could ask on the SCL mailing list for an ETA, or wait until it appears in its final form. In the meantime, you could download the RPMs from koji directly.

    0 讨论(0)
  • 2021-02-15 11:40

    To install the full tools-set including gfortran on centos 7:

    yum install centos-release-scl
    yum install devtoolset-8
    scl enable devtoolset-8 -- bash
    

    enable the tools:

    source /opt/rh/devtoolset-8/enable 
    

    you may wish to put the command above in .bash_profile

    ref: https://unix.stackexchange.com/questions/477360/centos-7-gcc-8-installation

    0 讨论(0)
  • 2021-02-15 11:57

    The follows worked in centos/rhel 7.

    • How to install it?
    # rpm -ivh http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm
    # yum install devtoolset-8
    

    Here is the rpm from http://mirror.centos.org/centos/7/extras/x86_64/Packages/ that might be needed to be updated accordingly.

    • How to use it?
    $ scl enable devtoolset-8 bash
    $ gcc --version
    gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
    Copyright (C) 2018 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.
    
    

    The flags -std=c++17 -lstdc++fs and the following line could be helpful.

    #include <experimental/filesystem>
    
    0 讨论(0)
提交回复
热议问题