How to install gcc8 using devtoolset-8-gcc

心不动则不痛 提交于 2020-12-29 06:23:52

问题


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 site on how to install gcc v7 link 1 which describes how to install gcc v7 (using devtoolset-7-gcc*). I did follow the guidelines and was able to install gcc v7. Though, if I followed the same procedure, but used "devtoolset-8-gcc*" instead the return message states "No package devtoolset-8-gcc* available.".

Performed a search and found a page called "Information for build devtoolset-8-gcc-8.1.1-4.el6" link 2, but not sure how to install this. I believe I would need to download the rpm source, compile/build the source, then finally install it.

Basically, I am looking for a easy way to install gcc v8 just like using the method described on link 1.

Thanks in advance.


回答1:


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.




回答2:


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




回答3:


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>


来源:https://stackoverflow.com/questions/53310625/how-to-install-gcc8-using-devtoolset-8-gcc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!