Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating g++ on CentOS 5.8

Tags:

gcc

centos5

I am currently using CentOS 5.8 and I would like to update g++ to the most recent version. My current version of g++ is 4.1.2, and when I try to update it says I am already on the latest version.

Is there a way to force update to the current version?

like image 290
JME Avatar asked Dec 17 '25 15:12

JME


1 Answers

The RHEL (and CentOS) 5.x series use GCC 4.1 and do not provide newer versions because they are stable, "enterprise" distributions so you can't update to a newer version using yum.

(If you want a newer system compiler then don't use such an old "Enterprise" distribution, either use CentOS 6 or a non-enterprise distro such as Fedora).

It's easy to install a newer GCC elsewhere on the system and then use that instead. Just download the gcc-4.9.0.tar.gz file from a GNU mirror and read Installing GCC for simple instructions on building it. It is a bad idea to overwrite the existing system compiler, you should install to /usr/local or /opt or another directory. You can then alter your $PATH so the newer GCC will be used. You should also read about setting dynamic library paths in the libstdc++ FAQ.

Another alternative is to install the Developer Toolset, which is an optional add-on providing a recent version of GCC and other dev tools, see http://linux.web.cern.ch/linux/devtoolset/ for a re-packaged version for Scientific Linux that should be compatible with CentOS.

like image 107
Jonathan Wakely Avatar answered Dec 19 '25 07:12

Jonathan Wakely



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!