skip to Main Content

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


  1. 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

    Login or Signup to reply.
  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:

    1. Install your prereqs (rpm build tools, devtools for bootstrapping your environment).
    2. Clone the repo.
    3. Checkout a branch in the repo like the major version of GCC you want (e.g. gcc7).
    4. In the repo, edit gcc-build-vars.sh such that it points to a version of GCC you want from http://gnu.mirror.constant.com/gcc/.
    5. Perform the build with: ./build-gcc.sh -T | tee build.log.
    6. Stage it: ./stage-gcc.sh.
    7. Package it: (./pack-gcc.sh or ./make-gcc-rpm.sh -v).
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search