1

Seems that gcc on CentOS 5.5 is a few versions behind the latest, which has some optimizations that I would seriously welcome. What is the best practice for installing and upgrading gcc?

1 Answer 1

2

The best practice for upgrading gcc away from the stock CentOS version is: don't.

It's a lot of hassle, there's a lot of dependencies, and you're likely to break something. And it's very unlikely that you'll get any kind of noticeable benefit from those optimizations.

Let me reiterate: it's best to stick with the stock GCC on CentOS/RH.

However, if you're really determined to, I'd install it into /opt, specifically something like /opt/gcc-4.5.1/. You'll have /opt/gcc-4.5.1/bin, /opt/gcc-4.5.1/lib, etc.. Symlink /opt/gcc to /opt/gcc-4.5.1 and put /opt/gcc/bin in your path, etc. That way you'll still be able to pick which gcc you're going to run so that normal tools that really need the correct CentOS gcc release will work right and you can run your special GCC as needed. And that way when you update to gcc-4.6.7 you install it into /opt/gcc-4.6.7, change the /opt/gcc symlink and remove the /opt/gcc-4.5.1 directory and be done with the update.

2
  • Curious why you say you're unlikely to see noticeable benefits. The benefits I have in mind are not in the code produced by the compiler, but in the compiler's performance itself.
    – TallPines
    Sep 21, 2010 at 22:43
  • True, but don't forget the gcc-44 packages.
    – mattdm
    Jan 21, 2011 at 10:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .