Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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 '10 at 22:43
    
True, but don't forget the gcc-44 packages. –  mattdm Jan 21 '11 at 10:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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