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?
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.
Related
My question is similar to how to install gcc 4.9.2 on RHEL 7.4
But I'm trying to get C++14 support on Red Hat 7 so I can install mapnik.
I've tried:
# yum-config-manager --enable rhel-server-rhscl-7-rpms
Install gcc, g++ version 4.9.2 :
# yum install devtoolset-3-gcc-c++
Enabling gcc-4.9, g++-4.9 : $ scl enable devtoolset-3 bash
But I keep getting
C++ compiler does not support C++14 standard (-std=c++14), which is required. Please upgrade your compiler
The issue is that devtoolset-3 contains the c++11 standard. Making and installing GCC from source caused two GCC versions to exist together. The default being the c++11 version. In order to get the correct version of gcc I needed to install devtoolset-7 and make sure devtoolset-3 was superseded or removed.
Here is how I enabled it:
1. Install a package with repository for your system:
On RHEL, enable RHSCL repository for your system:
$ sudo yum-config-manager --enable rhel-server-rhscl-7-rpms
2. Install the collection:
$ sudo yum install devtoolset-7
3. Start using software collections:
$ scl enable devtoolset-7 bash
You can download GCC sources and build it.
Generally the process involve:
Download tar.gz with GCC source code, from here: https://ftp.gnu.org/gnu/gcc/
Configure, Make and install. You can look for documentation in their site on how to do it, specifically you can start here:
https://gcc.gnu.org/wiki/InstallingGCC
i want to install latest version of GCC on RHEL 6.5 version.There is a old version of GCC already installed(GCC version 4.4.7 20120313).I want a way such that i need to install GCC in my private folder and only i can use this to compile code.other users who compile should be based on older version.
I have built a C++ app on a VM Ubuntu 16.04 on which I have installed g++ compiler 6.2.0 in order to support C++14 features. When I tried to run it on new clean VM 16.04 which has default the g++ 5.4.0 the error /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.22' not found pops up.
I've noticed that on the VM with the updated compiler library libstdc++.so.6.0.22 has been installed. On the clean VM I'd like to avoid to update the compiler so I tried to install only the latest libstdc++6 package. However the library that was installed was libstdc++.so.6.0.21 and so the problem persisted. How can I install specifically the libstdc++.so.6.0.22 version?
You need to upgrade libstdc++6 to latest version like this
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo apt-get upgrade libstdc++6
After that you can check if you get GLIBCXX desired version like this:
strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
You could try to use pinning to make sure only the packages you want are updated to a newer version.
Alternatively, you could simply compile your program with g++ 5.4, because according to this page, this compiler already supports all c++14, the only difference is that g++-6 defaults to -std=c++14, whereas with g++-5 you have to set the language standard explicitly.
Due to legacy issues I have to install the gcc/g++ version 4.4.7 in my current Ubuntu-gnome 14.04 32 bit virtual machine.
The default update via apt-get install is the 4.8.2 which is a "no go" work for this project.
I've removed it (apt-get remove) . The downloaded and tried to install the 4.4.7 source but it requires to many dependencies.
Via apt-get install I've tried doing:
sudo apt-get install gcc-4.4
The download/install is quite fast and when checkign gcc version it give indication that no gcc is installed to run the
sudo apt-get install gcc
If I do this I'll get the 4.8version.
All above also applies to g++.
I compiled the code with the following flag which solved the problem:
g++-4.4.7
It compiles for a specific version. (in this case 4.4.7)
To install a specific version use sudo apt-get install package=version. Or use synaptic package manager which allows you to install specific versions.
I'd like to build the latest version of gcc on a mac. I have the latest xcode but I'm looking for some of the c++0x features that are in more recent versions (the lambda functions, etc).
Are there any good step-by-step tutorials on doing this?
You should look at the Homebrew project.
Homebrew allows you to do things like this:
brew install gcc
Mac homebrew installation instructions are available here.
Add GCC support to a fresh Xcode 4.2 installation using this homebrew formula:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb
Upgrading from Xcode 4.1 doesn't drop existing GCC support, so this formula is only useful if you're working with a fresh 4.2+ installation.
One option is to install MacPorts and install the gcc46 package:
sudo port install gcc46
Another option is to download the source code and build it as follows:
tar xzvf gcc-4.6.0.tar.gz
cd gcc-4.6.0
./configure
make
Note that GCC 4.6.0 requires as prerequisites GMP 4.2+, MPFR 2.3.1+, and MPC 0.8.0+. If ./configure fails, it's probably because you're missing one of these (though it should give you a helpful error message in any case).
Building will take a while—likely several hours, depending on your hardware.
I would suggest building it yourself (Adam details how to do so). This will give you fine control on where to install and all the options you want to select. My experience from having multiple versions of gcc is that, if care is not taken apple's version of gcc can be damaged.
To speed up gcc installation you might want to look at --enable-languages option. If there are languages you don't need installed with the new gcc then you may not want to select them.