-
-
Save application2000/73fd6f4bf1be6600a2cf9f56315a2d91 to your computer and use it in GitHub Desktop.
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 |
this still doesn't explain how to install gcc/g++10 on ubuntu 16.04.7, which some folks are still not by choice forced to work with.
Heh...apparently the bot doesn't get the sadistic humor of still being forced to work on an O.S. that stopped being supported 3yrs ago.
Regardless, it appears there is no prebuilt package for gcc10 on 16.04 which means if you want it you'll have to build it from source. Clang is surprisingly easy to build from source but I have no idea about GCC.
@alexandreelise weird thing to say based on two comments on related gist from someone with multiple 1500+ star repos, but okay? I found this gist while looking for info on how to install the latest GCC on Ubuntu 16, so past version 9, which is what the other gist I commented on was for. Of course, I had been hoping someone had posted a copy-paste solution for gcc 10 already, but that was unfortunately not the case. I might add a comment with instructions if I can make some of the stackoverflow posts I managed to find work.
As for @jasonbeach's sadism remark, that's unfortunately far too real: I'm forced to work on a project that's still stuck on Ubuntu 16.04.7 (and not even kernel 4.15, but 4.4). I wish it wasn't, reality is not always so kind. There are way too many projects still stuck on 8 year old code bases running on even older infrastructure. I'm just trying to find anything that will let me get these projects migrated off of these dead versions of ubuntu.
@Pomax. Your account seems to behave like a bot. Since I unsure. I'll ignore your comments from now on. If you are not a bot. The real answer to what you want is trial and error until you succeed. Struggles is part of the journey. Instant answer on a plate will not help you learn. Have a delightful day (bot)?