2

I tried to install devtoolset-4.0 to use g++ version 5.x via

sudo yum install devtoolset-4

However, I got No package devtoolset-4 available.

Is there any way to get to that?

1
  • 2
    If you just want g++ and its dependencies: After adding the SCL repos as in @13nilux's answer, you may want to install devtoolset-4-toolchain (22 packages including binutils and gcc-c++) rather than devtoolset-4 (278 packages including the toolchain plus eclipse and many other java tools). – Mark Plotnick Mar 22 '17 at 15:43
6

Install it by:

sudo yum install centos-release-scl
sudo yum install devtoolset-4

The first command installs and enables Software Collections Repository on your CentOS machine. That repository provides the devtoolset package.

1

This does not work on CentOS 6.10 anymore.

Those are the ones available without jumping through hoops:

[misp@misp-centos6 ~]$ yum search devtoolset |grep devtoolset|awk {'print $1'} |cut -f 1,2 -d\-|sort|uniq
===========================
devtoolset-6
devtoolset-6.x86_64
devtoolset-7
devtoolset-7.x86_64
1

I was creating Dockerfile for old CentOS 6.8 with g++ 5.2.1. Here is what worked:

# yum install -y centos-release-scl-rh \
&& DTS4_PACKAGES="devtoolset-4-gcc-5.2.1 devtoolset-4-gcc-c++-5.2.1 devtoolset-4-gdb" \
&& yum -y install --enablerepo=centos-sclo-rh-testing --setopt=tsflags=nodocs $DTS4_PACKAGES \
&& yum -y clean all --enablerepo='*' \
&& export PATH=/opt/rh/devtoolset-4/root/usr/bin:$PATH

and using install devtoolset-4 would install the whole lot, including eclipse.

Some packages are available on vault.centos.org, but not on mirror.centos.org and they can be loaded with yum-utils and yumdownloader.

More info:

centos.pkgs.org/6/centos-sclo-rh-testing-x86_64/devtoolset-4-gcc-5.2.1-2.2.el6.x86_64.rpm https://www.rootusers.com/how-to-install-an-rpm-file-in-linux/ http://vault.centos.org/centos/6.8/sclo/x86_64/rh/devtoolset-4/

1

You can enable the testing repository:

sudo yum -y install centos-release-scl
sudo yum-config-manager --enable centos-sclo-rh-testing
sudo yum install devtoolset-4-toolchain

devtoolset-4-toolchain installs relevant packages for c++. devtoolset-3 is broken on Centos6, it is available from Scientific Linux.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.