I’ve been struggling with this for the past 2h. In CentOS 8 I can’t find the devtoolset
packages to install older gcc/g++ versions. There is no longer a scl
repo for CentOS 8. I need gcc/g++ 4.9x installed along the current gcc/g++ 8.x and I need to be able to switch between the two. This was extremely easy to set up in Ubuntu, not the case in CentOS and the documentation is non-existent or I had trouble finding it.
2
Answers
If you wish to install an older gcc than the distro provides, you will need to compile it for source.
There is some guidance below on how to download and build an old GCC
https://bytefreaks.net/gnulinux/downgrade-gcc-on-centos-7-0-64bit-to-version-4-8-2
Found a solid path that has automated compiling and packaging gcc, as well as a guide:
I won’t copy paste what’s in this person’s guide as they deserve the credit. However, here’s a summary of the steps:
gcc7
).gcc-build-vars.sh
such that it points to a version of GCC you want fromhttp://gnu.mirror.constant.com/gcc/
../build-gcc.sh -T | tee build.log
../stage-gcc.sh
../pack-gcc.sh
or./make-gcc-rpm.sh -v
).