Instantly share code, notes, and snippets.

Embed
What would you like to do?
use gcc 5.x on ubuntu 14.04
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
@vineeshvs

This comment has been minimized.

Show comment
Hide comment
@vineeshvs

vineeshvs Jun 25, 2016

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 1

to set first priority to gcc-5

vineeshvs commented Jun 25, 2016

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 1

to set first priority to gcc-5

@hallahan

This comment has been minimized.

Show comment
Hide comment
@hallahan

hallahan commented Sep 19, 2016

👍

@Antttooon

This comment has been minimized.

Show comment
Hide comment
@Antttooon

Antttooon Oct 18, 2016

спасибо =)

Antttooon commented Oct 18, 2016

спасибо =)

@MagnetonBora

This comment has been minimized.

Show comment
Hide comment
@MagnetonBora

MagnetonBora commented Feb 3, 2017

Thanks 👍

@rrogers

This comment has been minimized.

Show comment
Hide comment
@rrogers

rrogers Apr 24, 2017

This works!

rrogers commented Apr 24, 2017

This works!

@dtamez

This comment has been minimized.

Show comment
Hide comment
@dtamez

dtamez Jun 8, 2017

Thanks :)

dtamez commented Jun 8, 2017

Thanks :)

@benzkji

This comment has been minimized.

Show comment
Hide comment
@benzkji

benzkji Jun 24, 2017

still works for me on ubuntu 17 / zesty. ppa is not even needed!

benzkji commented Jun 24, 2017

still works for me on ubuntu 17 / zesty. ppa is not even needed!

@paomian

This comment has been minimized.

Show comment
Hide comment
@paomian

paomian Sep 11, 2017

gcc7

sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
sudo apt-get install gcc-7 g++-7

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7

paomian commented Sep 11, 2017

gcc7

sudo add-apt-repository ppa:jonathonf/gcc-7.1
sudo apt-get update
sudo apt-get install gcc-7 g++-7

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7
@NorimasaNabeta

This comment has been minimized.

Show comment
Hide comment
@NorimasaNabeta

NorimasaNabeta commented Jan 30, 2018

thx

@bryceschober

This comment has been minimized.

Show comment
Hide comment
@bryceschober

bryceschober Mar 5, 2018

WARNING @beci @vineeshvs @hallahan @Antttooon @MagnetonBora @rrogers @dtamez @benzkji @NorimasaNabeta:

The ppa:ubuntu-toolchain-r/test has old compiler builds that don't correctly compile some dkms kernel drivers, like nVidia, and you can get your installation pretty broken with the compilers from this PPA. See this launchpad issue for details.

bryceschober commented Mar 5, 2018

WARNING @beci @vineeshvs @hallahan @Antttooon @MagnetonBora @rrogers @dtamez @benzkji @NorimasaNabeta:

The ppa:ubuntu-toolchain-r/test has old compiler builds that don't correctly compile some dkms kernel drivers, like nVidia, and you can get your installation pretty broken with the compilers from this PPA. See this launchpad issue for details.

@SeanSyue

This comment has been minimized.

Show comment
Hide comment
@SeanSyue

SeanSyue Mar 14, 2018

update-alternatives: error:

I'm working on Ubuntu 16.04. The first three code ran properly, but when I was running the code

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

I got the error:

update-alternatives: error: alternative g++ can't be slave of gcc: it is a master alternative

Can someone answer me what may have gone wrong?

SeanSyue commented Mar 14, 2018

update-alternatives: error:

I'm working on Ubuntu 16.04. The first three code ran properly, but when I was running the code

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

I got the error:

update-alternatives: error: alternative g++ can't be slave of gcc: it is a master alternative

Can someone answer me what may have gone wrong?

@sg552

This comment has been minimized.

Show comment
Hide comment
@sg552

sg552 Apr 11, 2018

good job, works , thank you!

sg552 commented Apr 11, 2018

good job, works , thank you!

@rehmanzafar

This comment has been minimized.

Show comment
Hide comment
@rehmanzafar

rehmanzafar May 14, 2018

Thank you, it worked.

rehmanzafar commented May 14, 2018

Thank you, it worked.

@mathieu-aubin

This comment has been minimized.

Show comment
Hide comment
@mathieu-aubin

mathieu-aubin May 17, 2018

fast&clean

kudos

mathieu-aubin commented May 17, 2018

fast&clean

kudos

@apoorva-js

This comment has been minimized.

Show comment
Hide comment
@apoorva-js

apoorva-js Jun 5, 2018

@SeanSyue I'm got the same error as yours. Can you please help me if you figured it out.

apoorva-js commented Jun 5, 2018

@SeanSyue I'm got the same error as yours. Can you please help me if you figured it out.

@JOELEJAUNE

This comment has been minimized.

Show comment
Hide comment
@JOELEJAUNE

JOELEJAUNE commented Jun 7, 2018

thank you

@dongnhzigexn

This comment has been minimized.

Show comment
Hide comment
@dongnhzigexn

dongnhzigexn Jul 10, 2018

It works like a charm on Ubuntu 18.04. Thank you 👍

dongnhzigexn commented Jul 10, 2018

It works like a charm on Ubuntu 18.04. Thank you 👍

@anandbaskaran

This comment has been minimized.

Show comment
Hide comment
@anandbaskaran

anandbaskaran commented Jul 13, 2018

Thanks

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