Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install gcc-snapshot -y && \
sudo apt-get update && \
sudo apt-get install gcc-6 g++-6 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
sudo apt-get install gcc-4.8 g++-4.8 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;
When completed, you must change to the gcc you want to work with by default. Type in your terminal:
sudo update-alternatives --config gcc
To verify if it worked. Just type in your terminal
gcc -v
If everything went fine you should see gcc 6.1.1 by the time I am writing this gist
Happy coding!
See my blog post at https://www.application2000.com
@mdhanasar

This comment has been minimized.

Show comment
Hide comment
@mdhanasar

mdhanasar Jun 28, 2016

Worked without any issues on a new install of Ubuntu 16.04. Thank you..

mdhanasar commented Jun 28, 2016

Worked without any issues on a new install of Ubuntu 16.04. Thank you..

@GHnubsST

This comment has been minimized.

Show comment
Hide comment
@GHnubsST

GHnubsST Jul 17, 2016

worked perfectly thanks.

GHnubsST commented Jul 17, 2016

worked perfectly thanks.

@AnanthanM

This comment has been minimized.

Show comment
Hide comment
@AnanthanM

AnanthanM commented Aug 16, 2016

Thank You

@yech1990

This comment has been minimized.

Show comment
Hide comment
@yech1990

yech1990 Aug 28, 2016

g++-6 : Depends: gcc-6-base (= 6.1.1-2ubuntu12~16.04) but 6.1.1-3ubuntu11~14.04.1 is to be installed
         Depends: libstdc++-6-dev (= 6.1.1-2ubuntu12~16.04) but it is not going to be installed
 gcc-6 : Depends: cpp-6 (= 6.1.1-2ubuntu12~16.04) but it is not going to be installed
         Depends: gcc-6-base (= 6.1.1-2ubuntu12~16.04) but 6.1.1-3ubuntu11~14.04.1 is to be installed
         Depends: libgcc-6-dev (= 6.1.1-2ubuntu12~16.04) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

yech1990 commented Aug 28, 2016

g++-6 : Depends: gcc-6-base (= 6.1.1-2ubuntu12~16.04) but 6.1.1-3ubuntu11~14.04.1 is to be installed
         Depends: libstdc++-6-dev (= 6.1.1-2ubuntu12~16.04) but it is not going to be installed
 gcc-6 : Depends: cpp-6 (= 6.1.1-2ubuntu12~16.04) but it is not going to be installed
         Depends: gcc-6-base (= 6.1.1-2ubuntu12~16.04) but 6.1.1-3ubuntu11~14.04.1 is to be installed
         Depends: libgcc-6-dev (= 6.1.1-2ubuntu12~16.04) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
@zxshoe

This comment has been minimized.

Show comment
Hide comment
@zxshoe

zxshoe Sep 21, 2016

This worked fine today.

update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
`

Selection Path Priority Status

  • 0 /usr/bin/gcc-6 60 auto mode
    1 /usr/bin/gcc-4.8 60 manual mode
    2 /usr/bin/gcc-6 60 manual mode

Press to keep the current choice[*], or type selection number:`

Thanks!

zxshoe commented Sep 21, 2016

This worked fine today.

update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
`

Selection Path Priority Status

  • 0 /usr/bin/gcc-6 60 auto mode
    1 /usr/bin/gcc-4.8 60 manual mode
    2 /usr/bin/gcc-6 60 manual mode

Press to keep the current choice[*], or type selection number:`

Thanks!

@andrewrech

This comment has been minimized.

Show comment
Hide comment
@andrewrech

andrewrech Nov 28, 2016

Very helpful, thank you

andrewrech commented Nov 28, 2016

Very helpful, thank you

@jwarlander

This comment has been minimized.

Show comment
Hide comment
@jwarlander

jwarlander Dec 1, 2016

Thanks, worked great!

I modified it slightly to keep the default 16.04 gcc-5 around:

 sudo apt-get update && \
 sudo apt-get install build-essential software-properties-common -y && \
 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
 sudo apt-get update && \
 sudo apt-get install gcc-snapshot -y && \
 sudo apt-get update && \
 sudo apt-get install gcc-6 g++-6 -y && \
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
-sudo apt-get install gcc-4.8 g++-4.8 -y && \
-sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;
+# Already installed gcc-5 as part of build-essential; I didn't need this line..
+# sudo apt-get install gcc-5 g++-5 -y && \
+sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5;

jwarlander commented Dec 1, 2016

Thanks, worked great!

I modified it slightly to keep the default 16.04 gcc-5 around:

 sudo apt-get update && \
 sudo apt-get install build-essential software-properties-common -y && \
 sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
 sudo apt-get update && \
 sudo apt-get install gcc-snapshot -y && \
 sudo apt-get update && \
 sudo apt-get install gcc-6 g++-6 -y && \
 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
-sudo apt-get install gcc-4.8 g++-4.8 -y && \
-sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;
+# Already installed gcc-5 as part of build-essential; I didn't need this line..
+# sudo apt-get install gcc-5 g++-5 -y && \
+sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5;
@Sakib37

This comment has been minimized.

Show comment
Hide comment
@Sakib37

Sakib37 Dec 2, 2016

Thanks. Worked perfectly. :)

Sakib37 commented Dec 2, 2016

Thanks. Worked perfectly. :)

@ArulrajAnto

This comment has been minimized.

Show comment
Hide comment
@ArulrajAnto

ArulrajAnto Dec 4, 2016

Hi, i am getting below error while trying to upgrade gcc,

root@compute:/tmp# sudo apt-get update && \

sudo apt-get install build-essential software-properties-common -y &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y &&
sudo apt-get update &&
sudo apt-get install gcc-snapshot -y &&
sudo apt-get update &&
sudo apt-get install gcc-6 g++-6 -y &&
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 &&
-sudo apt-get install gcc-4.8 g++-4.8 -y &&
-sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;
Hit:1 http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu xenial InRelease
Ign:2 http://ubuntu-cloud.archive.canonical.com/ubuntu xenial-updates/newton InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease
Hit:5 http://ubuntu-cloud.archive.canonical.com/ubuntu xenial-updates/newton Release
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 306 kB in 1s (199 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
build-essential set to manually installed.
software-properties-common is already the newest version (0.96.20.4).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
cpp-5 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
g++-5 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
gcc-5 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libasan2 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libatomic1 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libcc1-0 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libcilkrts5 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libgcc-5-dev : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libgomp1 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libitm1 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
liblsan0 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libmpx0 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libquadmath0 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libstdc++-5-dev : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libstdc++-5-dev:i386 : Depends: gcc-5-base:i386 (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
Depends: libgcc-5-dev:i386 (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
Depends: libstdc++6:i386 (>= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
Depends: libc6-dev:i386 (>= 2.13-0ubuntu6) but it is not going to be installed
libstdc++6 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libtsan0 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libubsan0 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

please help me to short it out.

ArulrajAnto commented Dec 4, 2016

Hi, i am getting below error while trying to upgrade gcc,

root@compute:/tmp# sudo apt-get update && \

sudo apt-get install build-essential software-properties-common -y &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y &&
sudo apt-get update &&
sudo apt-get install gcc-snapshot -y &&
sudo apt-get update &&
sudo apt-get install gcc-6 g++-6 -y &&
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 &&
-sudo apt-get install gcc-4.8 g++-4.8 -y &&
-sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8;
Hit:1 http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu xenial InRelease
Ign:2 http://ubuntu-cloud.archive.canonical.com/ubuntu xenial-updates/newton InRelease
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Hit:4 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease
Hit:5 http://ubuntu-cloud.archive.canonical.com/ubuntu xenial-updates/newton Release
Get:7 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Get:8 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 306 kB in 1s (199 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
build-essential set to manually installed.
software-properties-common is already the newest version (0.96.20.4).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
cpp-5 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
g++-5 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
gcc-5 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libasan2 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libatomic1 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libcc1-0 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libcilkrts5 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libgcc-5-dev : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libgomp1 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libitm1 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
liblsan0 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libmpx0 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libquadmath0 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libstdc++-5-dev : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libstdc++-5-dev:i386 : Depends: gcc-5-base:i386 (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
Depends: libgcc-5-dev:i386 (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
Depends: libstdc++6:i386 (>= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
Depends: libc6-dev:i386 (>= 2.13-0ubuntu6) but it is not going to be installed
libstdc++6 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
libtsan0 : Depends: gcc-5-base (= 5.4.0-6ubuntu116.04.2) but it is not going to be installed
libubsan0 : Depends: gcc-5-base (= 5.4.0-6ubuntu1
16.04.2) but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

please help me to short it out.

@ArulrajAnto

This comment has been minimized.

Show comment
Hide comment
@ArulrajAnto

ArulrajAnto Dec 4, 2016

root@compute:/tmp# update-alternatives --config gcc
update-alternatives: error: no alternatives for gcc

ArulrajAnto commented Dec 4, 2016

root@compute:/tmp# update-alternatives --config gcc
update-alternatives: error: no alternatives for gcc

@HungryHowies

This comment has been minimized.

Show comment
Hide comment
@HungryHowies

HungryHowies Feb 2, 2017

Good Stuff!! thank you worked great on Ubuntu 16.0.4

HungryHowies commented Feb 2, 2017

Good Stuff!! thank you worked great on Ubuntu 16.0.4

@AraHaan

This comment has been minimized.

Show comment
Hide comment
@AraHaan

AraHaan Feb 17, 2017

nice, just need it for clang 3.9 for Travis CI.

AraHaan commented Feb 17, 2017

nice, just need it for clang 3.9 for Travis CI.

@KyCodeHuynh

This comment has been minimized.

Show comment
Hide comment
@KyCodeHuynh

KyCodeHuynh Mar 7, 2017

Hash sum mismatches when running apt-get update can be resolved by flushing metadata. Without the ability to update, the gcc-6 and g++-6 packages won't be available for install.

KyCodeHuynh commented Mar 7, 2017

Hash sum mismatches when running apt-get update can be resolved by flushing metadata. Without the ability to update, the gcc-6 and g++-6 packages won't be available for install.

@S0ulR3av3R

This comment has been minimized.

Show comment
Hide comment
@S0ulR3av3R

S0ulR3av3R Mar 16, 2017

what does the '-y' at the end of the line?

S0ulR3av3R commented Mar 16, 2017

what does the '-y' at the end of the line?

@talland

This comment has been minimized.

Show comment
Hide comment
@talland

talland Mar 16, 2017

Nice, thank you very much

talland commented Mar 16, 2017

Nice, thank you very much

@jasonbeach

This comment has been minimized.

Show comment
Hide comment
@jasonbeach

jasonbeach Mar 25, 2017

the -y flag causes apt-get to assume "yes" when it would normally prompt you with a yes /no question

jasonbeach commented Mar 25, 2017

the -y flag causes apt-get to assume "yes" when it would normally prompt you with a yes /no question

@smac89

This comment has been minimized.

Show comment
Hide comment
@smac89

smac89 Apr 20, 2017

This is great
Gcc version 6.2.0

smac89 commented Apr 20, 2017

This is great
Gcc version 6.2.0

@zheive

This comment has been minimized.

Show comment
Hide comment
@zheive

zheive Apr 21, 2017

Work very well for me, I had problems after update my kernel version with vmware.

Thanks!

zheive commented Apr 21, 2017

Work very well for me, I had problems after update my kernel version with vmware.

Thanks!

@ivanmara555

This comment has been minimized.

Show comment
Hide comment
@ivanmara555

ivanmara555 May 23, 2017

Toolchain ppa updates to gcc-7.1 on 16.04 Xenial. Additional install instructions:

apt-get upgrade
apt-get full-upgrade
apt-get install gcc-7 g++-7
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
update-alternatives --config gcc

select gcc-7

ivanmara555 commented May 23, 2017

Toolchain ppa updates to gcc-7.1 on 16.04 Xenial. Additional install instructions:

apt-get upgrade
apt-get full-upgrade
apt-get install gcc-7 g++-7
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
update-alternatives --config gcc

select gcc-7

@application2000

This comment has been minimized.

Show comment
Hide comment
@application2000

application2000 May 30, 2017

Hopefully it could help someone. Take care and Have a nice day. Cheers.

Owner

application2000 commented May 30, 2017

Hopefully it could help someone. Take care and Have a nice day. Cheers.

@peterhanneman

This comment has been minimized.

Show comment
Hide comment
@peterhanneman

peterhanneman Jun 9, 2017

GCC 7.1 on Ubuntu 14.04 & 16.04:

sudo apt-get update -y && \
sudo apt-get upgrade -y && \
sudo apt-get dist-upgrade -y && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update -y && \
sudo apt-get install gcc-7 g++-7 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7 && \
sudo update-alternatives --config gcc

peterhanneman commented Jun 9, 2017

GCC 7.1 on Ubuntu 14.04 & 16.04:

sudo apt-get update -y && \
sudo apt-get upgrade -y && \
sudo apt-get dist-upgrade -y && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update -y && \
sudo apt-get install gcc-7 g++-7 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7 && \
sudo update-alternatives --config gcc
@toffyjan

This comment has been minimized.

Show comment
Hide comment
@toffyjan

toffyjan Jun 21, 2017

Work very well for me.

Thanks!

toffyjan commented Jun 21, 2017

Work very well for me.

Thanks!

@application2000

This comment has been minimized.

Show comment
Hide comment
@application2000

application2000 Jun 22, 2017

@peterhanneman Thank you for the update. Take care

Owner

application2000 commented Jun 22, 2017

@peterhanneman Thank you for the update. Take care

@k-five

This comment has been minimized.

Show comment
Hide comment
@k-five

k-five Jun 24, 2017

thank you ivanmara555 worked on 16.04 LTS..
Sat Jun 24 2017 GMT

k-five commented Jun 24, 2017

thank you ivanmara555 worked on 16.04 LTS..
Sat Jun 24 2017 GMT

@hanzin

This comment has been minimized.

Show comment
Hide comment
@hanzin

hanzin Jun 27, 2017

thank you , this work very well !

hanzin commented Jun 27, 2017

thank you , this work very well !

@jacobtylerdavis

This comment has been minimized.

Show comment
Hide comment
@jacobtylerdavis

jacobtylerdavis Jul 14, 2017

Thank you! This works on Debian as well but instead of adding the Ubuntu repo you can add deb http://ftp.us.debian.org/debian testing main contrib non-free to the end of /etc/apt/sources.list

jacobtylerdavis commented Jul 14, 2017

Thank you! This works on Debian as well but instead of adding the Ubuntu repo you can add deb http://ftp.us.debian.org/debian testing main contrib non-free to the end of /etc/apt/sources.list

@smutandwa

This comment has been minimized.

Show comment
Hide comment
@smutandwa

smutandwa Jul 16, 2017

Thanks, this worked for me on Ubuntu 16.04.

smutandwa commented Jul 16, 2017

Thanks, this worked for me on Ubuntu 16.04.

@application2000

This comment has been minimized.

Show comment
Hide comment
@application2000

application2000 Jul 30, 2017

Thanks for the tip @1Forge. Thank you all for your comments. Hope it helps everybody. Happy coding!

Owner

application2000 commented Jul 30, 2017

Thanks for the tip @1Forge. Thank you all for your comments. Hope it helps everybody. Happy coding!

@jlettvin

This comment has been minimized.

Show comment
Hide comment
@jlettvin

jlettvin Aug 14, 2017

Thank you peterhanneman. Your one-liner worked perfectly.

jlettvin commented Aug 14, 2017

Thank you peterhanneman. Your one-liner worked perfectly.

@paberline

This comment has been minimized.

Show comment
Hide comment
@paberline

paberline Aug 21, 2017

This is gold dust! Many thanks.

paberline commented Aug 21, 2017

This is gold dust! Many thanks.

@komeilr

This comment has been minimized.

Show comment
Hide comment
@komeilr

komeilr Aug 24, 2017

Bro are you serious right now?! This worked like a fucking dream!

komeilr commented Aug 24, 2017

Bro are you serious right now?! This worked like a fucking dream!

@NemoDomum

This comment has been minimized.

Show comment
Hide comment
@NemoDomum

NemoDomum Sep 7, 2017

Thank you, solved an issue on Ubuntu 17.04

NemoDomum commented Sep 7, 2017

Thank you, solved an issue on Ubuntu 17.04

@justinjk007

This comment has been minimized.

Show comment
Hide comment
@justinjk007

justinjk007 Sep 8, 2017

Thank you very much. Upgraded from 5 to 6.3

justinjk007 commented Sep 8, 2017

Thank you very much. Upgraded from 5 to 6.3

@BeErikk

This comment has been minimized.

Show comment
Hide comment
@BeErikk

BeErikk Sep 17, 2017

Thanks, confirmed works on WSL Ubuntu 16.04

BeErikk commented Sep 17, 2017

Thanks, confirmed works on WSL Ubuntu 16.04

@SwapnilBorse123

This comment has been minimized.

Show comment
Hide comment
@SwapnilBorse123

SwapnilBorse123 Sep 18, 2017

worked fine! Thanks a lot :)

SwapnilBorse123 commented Sep 18, 2017

worked fine! Thanks a lot :)

@MostertMB

This comment has been minimized.

Show comment
Hide comment
@MostertMB

MostertMB Oct 7, 2017

Excellent! Still works from 4.9.3 to 6.3! Very helpful thank you!

MostertMB commented Oct 7, 2017

Excellent! Still works from 4.9.3 to 6.3! Very helpful thank you!

@siebeniris

This comment has been minimized.

Show comment
Hide comment
@siebeniris

siebeniris Nov 10, 2017

excellent! thanks very much!

siebeniris commented Nov 10, 2017

excellent! thanks very much!

@amendment19

This comment has been minimized.

Show comment
Hide comment
@amendment19

amendment19 Nov 16, 2017

Thank you! Such good directions. Worked like a charm.

amendment19 commented Nov 16, 2017

Thank you! Such good directions. Worked like a charm.

@RianWardana

This comment has been minimized.

Show comment
Hide comment
@RianWardana

RianWardana Nov 28, 2017

It works. Thanks!

RianWardana commented Nov 28, 2017

It works. Thanks!

@vikchopde

This comment has been minimized.

Show comment
Hide comment
@vikchopde

vikchopde Dec 30, 2017

Thanks .Very helpfull !!

vikchopde commented Dec 30, 2017

Thanks .Very helpfull !!

@zixuan75

This comment has been minimized.

Show comment
Hide comment
@zixuan75

zixuan75 Jan 1, 2018

This is not correct. if i type "sudo apt-get install gcc-6 g++-6 -y" command, it says "E: Unable to locate package gcc-6" and then "E: Unable to locate package g++-6" and then "E: Couldn't find any package by regex 'g++-6'".

zixuan75 commented Jan 1, 2018

This is not correct. if i type "sudo apt-get install gcc-6 g++-6 -y" command, it says "E: Unable to locate package gcc-6" and then "E: Unable to locate package g++-6" and then "E: Couldn't find any package by regex 'g++-6'".

@thinkjrs

This comment has been minimized.

Show comment
Hide comment
@thinkjrs

thinkjrs commented Jan 11, 2018

Thanks @peterhanneman!

@NickWoodhams

This comment has been minimized.

Show comment
Hide comment
@NickWoodhams

NickWoodhams Jan 25, 2018

Great work. 4.8 worked fantastically to compile mysql-python 1.2.5. Thanks!

NickWoodhams commented Jan 25, 2018

Great work. 4.8 worked fantastically to compile mysql-python 1.2.5. Thanks!

@cryptomaniac26

This comment has been minimized.

Show comment
Hide comment
@cryptomaniac26

cryptomaniac26 Feb 2, 2018

Awesome walk through. In detail and no nonsense! Thank you

cryptomaniac26 commented Feb 2, 2018

Awesome walk through. In detail and no nonsense! Thank you

@awwsmm

This comment has been minimized.

Show comment
Hide comment
@awwsmm

awwsmm Feb 16, 2018

Works great! Thanks.

awwsmm commented Feb 16, 2018

Works great! Thanks.

@bryceschober

This comment has been minimized.

Show comment
Hide comment

bryceschober commented Mar 5, 2018

@starjasmine

This comment has been minimized.

Show comment
Hide comment
@starjasmine

starjasmine Mar 8, 2018

That article is really informative! Thanks.

starjasmine commented Mar 8, 2018

That article is really informative! Thanks.

@stefson

This comment has been minimized.

Show comment
Hide comment
@stefson

stefson Mar 9, 2018

This might not be the right place to ask for it, but is there a possibility to install llvm + clang 5 toolchain for ubuntu 14.04 for armhf? I found ppa which has x86 and amd64, also 16.04 and newer have it in their repos? gcc is a bit buggy on arm, and also very demanding with memory consumption -_- where clang is just a blast. Faster in compiling, memory cut down by 50 to 80% (tested with amd64 and firefox), and also faster binaries.

Will llvm-4 and llvm-5 be added to trusty, as firefox seems to now depend on at least llvm-4?

stefson commented Mar 9, 2018

This might not be the right place to ask for it, but is there a possibility to install llvm + clang 5 toolchain for ubuntu 14.04 for armhf? I found ppa which has x86 and amd64, also 16.04 and newer have it in their repos? gcc is a bit buggy on arm, and also very demanding with memory consumption -_- where clang is just a blast. Faster in compiling, memory cut down by 50 to 80% (tested with amd64 and firefox), and also faster binaries.

Will llvm-4 and llvm-5 be added to trusty, as firefox seems to now depend on at least llvm-4?

@JorgeFrancoIbanez

This comment has been minimized.

Show comment
Hide comment
@JorgeFrancoIbanez

JorgeFrancoIbanez Mar 16, 2018

It works, for me when I've tried to install strongswan from source code! 👍

JorgeFrancoIbanez commented Mar 16, 2018

It works, for me when I've tried to install strongswan from source code! 👍

@Lakshmikanthaks

This comment has been minimized.

Show comment
Hide comment
@Lakshmikanthaks

Lakshmikanthaks Mar 18, 2018

It works, thank you :)

Lakshmikanthaks commented Mar 18, 2018

It works, thank you :)

@heartonbit

This comment has been minimized.

Show comment
Hide comment
@heartonbit

heartonbit Mar 20, 2018

Thanks, it works!

heartonbit commented Mar 20, 2018

Thanks, it works!

@ODYTRON

This comment has been minimized.

Show comment
Hide comment
@ODYTRON

ODYTRON Mar 27, 2018

Works like a charm!

ODYTRON commented Mar 27, 2018

Works like a charm!

@rkosti

This comment has been minimized.

Show comment
Hide comment
@rkosti

rkosti Apr 11, 2018

works perfectly!

rkosti commented Apr 11, 2018

works perfectly!

@ivanmara555

This comment has been minimized.

Show comment
Hide comment
@ivanmara555

ivanmara555 Apr 25, 2018

GCC 8.1.0 on Ubuntu 14.04 & 16.04 & 18.04:

sudo apt-get update -y &&
sudo apt-get upgrade -y &&
sudo apt-get dist-upgrade -y &&
sudo apt-get install build-essential software-properties-common -y &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y &&
sudo apt-get update -y &&
sudo apt-get install gcc-8 g++-8 -y &&
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8 &&
sudo update-alternatives --config gcc

select gcc-8

ivanmara555 commented Apr 25, 2018

GCC 8.1.0 on Ubuntu 14.04 & 16.04 & 18.04:

sudo apt-get update -y &&
sudo apt-get upgrade -y &&
sudo apt-get dist-upgrade -y &&
sudo apt-get install build-essential software-properties-common -y &&
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y &&
sudo apt-get update -y &&
sudo apt-get install gcc-8 g++-8 -y &&
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8 &&
sudo update-alternatives --config gcc

select gcc-8

@cortical-iv

This comment has been minimized.

Show comment
Hide comment
@cortical-iv

cortical-iv Apr 27, 2018

ivanmara555 thanks that works great on my Ubuntu 16 install!

cortical-iv commented Apr 27, 2018

ivanmara555 thanks that works great on my Ubuntu 16 install!

@dustars

This comment has been minimized.

Show comment
Hide comment
@dustars

dustars May 2, 2018

THANK YOU! I have been searching for a solution nearly 10 hours, and finally your method works for me!

dustars commented May 2, 2018

THANK YOU! I have been searching for a solution nearly 10 hours, and finally your method works for me!

@ivanmara555

This comment has been minimized.

Show comment
Hide comment
@ivanmara555

ivanmara555 May 3, 2018

method above now install gcc 8.1.0 ... Congratulations!)

ivanmara555 commented May 3, 2018

method above now install gcc 8.1.0 ... Congratulations!)

@F001

This comment has been minimized.

Show comment
Hide comment
@F001

F001 May 8, 2018

@ivanmara555 , I used above command, but only gcc 8.0.1 is installed (not 8.1.0).

gcc --version
gcc (Ubuntu 8-20180424-0ubuntu1~16.04.1) 8.0.1 20180424 (experimental) [trunk revision 259590]

My platform is Ubuntu 16.04.4 LTS. Could you please help to point out what's wrong?

F001 commented May 8, 2018

@ivanmara555 , I used above command, but only gcc 8.0.1 is installed (not 8.1.0).

gcc --version
gcc (Ubuntu 8-20180424-0ubuntu1~16.04.1) 8.0.1 20180424 (experimental) [trunk revision 259590]

My platform is Ubuntu 16.04.4 LTS. Could you please help to point out what's wrong?

@adrien1018

This comment has been minimized.

Show comment
Hide comment
@adrien1018

adrien1018 May 10, 2018

@F001 I got into the same situation on Ubuntu 14.04.5 LTS.

adrien1018 commented May 10, 2018

@F001 I got into the same situation on Ubuntu 14.04.5 LTS.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost May 12, 2018

Many thanks.. it works greats :)

ghost commented May 12, 2018

Many thanks.. it works greats :)

@nikunjsoni24

This comment has been minimized.

Show comment
Hide comment
@nikunjsoni24

nikunjsoni24 May 14, 2018

Worked, Thank you very much

nikunjsoni24 commented May 14, 2018

Worked, Thank you very much

@roshanashraf

This comment has been minimized.

Show comment
Hide comment
@roshanashraf

roshanashraf commented May 19, 2018

thanks

@bobuntu

This comment has been minimized.

Show comment
Hide comment
@bobuntu

bobuntu May 21, 2018

Nicely done and much appreciated. Thank you @ivanmara555 et al.

bobuntu commented May 21, 2018

Nicely done and much appreciated. Thank you @ivanmara555 et al.

@MaitreManuel

This comment has been minimized.

Show comment
Hide comment
@MaitreManuel

MaitreManuel Jul 17, 2018

Love you sir, it worked !

MaitreManuel commented Jul 17, 2018

Love you sir, it worked !

@erictarn

This comment has been minimized.

Show comment
Hide comment
@erictarn

erictarn Aug 9, 2018

sudo apt-get install python-software-properties needed for Ubuntu 12.04 in order to run add-apt-repository

erictarn commented Aug 9, 2018

sudo apt-get install python-software-properties needed for Ubuntu 12.04 in order to run add-apt-repository

@seanshpark

This comment has been minimized.

Show comment
Hide comment
@seanshpark

seanshpark commented Aug 13, 2018

Thank you!

@seergjej

This comment has been minimized.

Show comment
Hide comment
@seergjej

seergjej Aug 22, 2018

http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found

The whole jessie folder is gone. All other distros are there.

seergjej commented Aug 22, 2018

http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/dists/jessie/main/binary-amd64/Packages 404 Not Found

The whole jessie folder is gone. All other distros are there.

@siyavashvafshar

This comment has been minimized.

Show comment
Hide comment
@siyavashvafshar

siyavashvafshar Aug 26, 2018

Great !! saved a lot of time.

siyavashvafshar commented Aug 26, 2018

Great !! saved a lot of time.

@88plug

This comment has been minimized.

Show comment
Hide comment
@88plug

88plug Aug 27, 2018

Here is the Docker friendly format

FROM ubuntu:18.04
RUN apt-get update ; apt-get upgrade -y ; apt-get install -y gcc-8 g++-8 && \
  update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8 && \
  update-alternatives --config gcc

also available on https://hub.docker.com/r/88plug/gcc-8-ubuntu-18.04/

88plug commented Aug 27, 2018

Here is the Docker friendly format

FROM ubuntu:18.04
RUN apt-get update ; apt-get upgrade -y ; apt-get install -y gcc-8 g++-8 && \
  update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-8 && \
  update-alternatives --config gcc

also available on https://hub.docker.com/r/88plug/gcc-8-ubuntu-18.04/

@sorgina13

This comment has been minimized.

Show comment
Hide comment
@sorgina13

sorgina13 Sep 23, 2018

Thank you!

sorgina13 commented Sep 23, 2018

Thank you!

@UsmanMaqbool

This comment has been minimized.

Show comment
Hide comment
@UsmanMaqbool

UsmanMaqbool Oct 2, 2018

thanks a lot :)

UsmanMaqbool commented Oct 2, 2018

thanks a lot :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment