How can I install and use gcc 6 on xenial?
Solution 1
Looks like there is a gcc 6 package available for Xenial Xerus in the Toolchain test builds PPA:
Publishing details
Published on 2016-09-04
Changelog
gcc-6 (6.2.0-3ubuntu11~16.04) xenial; urgency=medium
* Build for 16.04 LTS.
-- Matthias Klose <email address hidden> Sun, 04 Sep 2016 14:19:52 +0200
Install the PPA and the compiler as follows:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-6 g++-6
This installed nicely on my Xenial system:
andrew@athens:~$ gcc-6 --version | head -n 2
gcc-6 (Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901
Copyright (C) 2016 Free Software Foundation, Inc.
andrew@athens:~$
Note that this does not make gcc 6 your default compiler and this is probably best at the moment until this most recent version matures a little...
References:
Solution 2
I prefer to use conda
environment in this case to provide gcc and g++ on "on request" use:
# Create 'cuda' environment and install gcc from 'rdonnelly' channel
conda create -n cuda gcc-6 -c rdonnelly
# or just install gcc into the existing 'cuda' environment
conda install -n cuda gcc-6 -c rdonnelly
#activate 'cuda' environment when needed:
source activate cuda
# after this, gcc version 6 is available for testing.
I use this to avoid possible confict with the stable and system-wide version of gcc
.
For those are new to conda
, it is a fantastic virtual environment tool to create isolated environment to install many tools, not only python
-related, but also all command tools for data analysis, and development. More info: https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html
Related videos on Youtube
user3317710
Updated on September 18, 2022Comments
-
user3317710 over 1 year
I wish to test existing software with gcc 6, to ensure that it will work when the transition takes place.
- How can I install gcc 6? Is there a ppa available?
- Can I just do a "CC=gcc-6 make" ?
Thanks
-
Ashu about 8 yearsYou can refer(askubuntu.com/questions/623350/…) though it is about gcc-5 but you can start looking in that direction.
-
Meteorhead over 7 yearsAwesome answer. Roughly how often does this ppa updates? GCC 6.2 has been out for over a week. Is that the timescale one should expect updates, or more like 1-1.5 months?
-
andrew.46 over 7 years@Meteorhead Looks like some work for the next Ubuntu release: launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/…