Going back to an old version of gcc

After upgrading to Fedora 32, I find the gcc version is at 10.1.1, which is way too advanced for the code stack I am doing development work on. Are there ways of going back to older versions short of running in a container? Gcc 4.8 would be the extreme end of what might be useful.

1 Like

You can use a container with podman:

https://hub.docker.com/_/gcc

there, are step to compile inside container… the oldest is 8…

  • Start a GCC instance running your app
  • Compile your app inside the Docker container

REFERENCES

Regards.,

1 Like

Perhaps have a look at this and see if it helps:

https://gcc.gnu.org/faq.html#multiple

Out of interest, why doesn’t the new GCC work for your code? New versions of GCC still support old standards. They are sometimes stricter though, and reject buggy code that doesn’t follow the standards, so I’m assuming that’s the issue for you.

If your code requires an old GCC (maybe because you’re developing for old versions of RHEL or CentOS) then it almost certainly also has other dependencies on old libraries. Simply installing an old GCC probably isn’t sufficient. Your two best options are to make the code more portable, so it works the same on the old OS and on modern Fedora releases, or to do your development in a container or VM, so that the entire stack (compiler and libc and other system libraries) matches the old systems you’re deploying on.

1 Like

That’s interesting. I don’t think I have ever seen that FAQ. Thanks.

1 Like

I was trying to avoid working in a container, but I think I am resigned to that now.

The code that is causing problems is third-party supplied. So hacking it is not all that easy and hard to automate when building that code in the future. Stricter compiler standards are definitely a a problem here.

Thanks for the thoughts.

1 Like