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" ?



2 Answers 2


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 

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.

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...



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

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