0

I am using Centos 7 with kernel 3.10.0

My current gcc version is 4.8.5 and I am trying to install gcc 7 or later versions. I have followed instructions from How to install GCC/G++ 8 on CentOS

When I try scl enable devtoolset-8 -- bash, it shows

Unable to open /etc/scl/conf/devtoolset-8!

Then I have checked in /etc/scl/conf/ where there is one file named 'devtoolset-9'. But I was expecting devtoolset-8.

If I run yum list installed | grep devtoolset, it shows packages related to devtoolset-8 and devtoolset-7. But I can not switch to gcc 7 or 8 because of that previous error. If I run scl enable devtoolset-9 -- bash, it does not change to the gcc version, stays at the default gcc. What may go wrong and how do I switch to gcc 7 or 8 in my case?

Misbah
  • 1
  • 3

2 Answers2

0

I ran into the same issue that you are facing and this is how I got it fixed:

  1. Just want to be careful, you need to exist the Terminal and open a fresh one to start. This way, you are not under any devtoolset's bash.
  2. Go to /opt/rh folder, run command ls -la to see if you have any devtoolset-* folder there. Let's say you have devtoolset-8, proceed step 2.
  3. Go to /etc/scl/prefixes folder, if you don't see devtoolset-8 file, you can create a new one as devtoolset-8, and type 1 line: /opt/rh, then save and quit that file.
  4. Once you are done, you can call: scl enable devtoolset-8 -- bash w/o any error. Good luck
P.A.
  • 1
0

just only runing 'yum install devtoolset-8-gcc devtoolset-8-gcc-c++' is not working for me too. i tried to run 'yum install devtoolset-8 -y, and it is working fine.

starball
  • 20,030
  • 7
  • 43
  • 238
  • 2
    Welcome to Stack Overflow! While this code may solve the question, [including an explanation](//meta.stackexchange.com/q/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please [edit] your answer to add explanations and give an indication of what limitations and assumptions apply. – Yunnosch May 03 '23 at 05:49