Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install GCC 5.1 on Linux (Ubuntu)

I'd like to experiment with the new GCC 5.1 C++ compiler on Ubuntu.

How can I install GCC 5.1 on Ubuntu?

I'd prefer some form of pre-built executable that I could just download and install, instead of downloading GCC's sources and building the whole GCC 5.1 from them.

Moreover, since I read libstdc++'s ABI changed in GCC 5, must a new version of libstdc++ be installed with GCC 5.1, too?

like image 361
MikePro Avatar asked May 04 '15 17:05

MikePro


People also ask

Is gcc available for Ubuntu?

Installing GCC: GCC and all the required build tools can be installed very easily on Ubuntu as all the required packages are available in the official package repository of Ubuntu. Ubuntu also provides the build-essential meta package that installs all the required packages all at once.


1 Answers

Package g++-5 (gcc version 5.2.1) is available in debian testing or in ubuntu wily. Previous milestones are 4.9 and 4.8. It would be more difficult to get a version in between, like 5.1.

If still satisfied with 5.2.1 then add this line to /etc/apt/sources.list:

deb http://ftp.debian.org/debian/ stretch main

Try to install package and its dependencies:

# apt-get update
# apt-get install g++-5

Then hope it is going to be installed without problems. (It strongly depends which ubuntu version is used on host.) A g++-4.9 install from stable debian (jessie) to ubuntu trusty (gcc 4.8) has been successful for me. When done comment out previously added line from sources list and

# apt-get update

If you are fond of eternal upgrades then set an apt pinning rule instead.

like image 187
renonsz Avatar answered Sep 28 '22 06:09

renonsz