Run the following in the terminal:
Install the gcc-7 packages:
sudo apt-get install -y software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install g++-7 -y
Set it up so the symbolic links gcc
, g++
point to the newer version:
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
gcc --version
g++ --version
# This one if you want the **all** toolchain programs (with the triplet names) to also point to gcc-7.
# For example, this is needed if building Debian packages.
# If you are already are root (e.g. inside a docker image), remove the "sudo" below.
ls -la /usr/bin/ | grep -oP "[\S]*(gcc|g\+\+)(-[a-z]+)*[\s]" | xargs sudo bash -c 'for link in ${@:1}; do ln -s -f "/usr/bin/${link}-${0}" "/usr/bin/${link}"; done' 7
I tried the steps listed here and now I can't properly use apt or pip, it's saying the connections are not able to be established.
Can you please tell me how to undo the first command:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
@jlblancoc, @proiecteit
To clarify, when I ran the command the first time it worked fine. I ran all of the commands listed here and shortly after they completed my vm crashed. I did not know if the changes had been saved (this has happened in the past) so I tried to re-run the commands and now the first command (the one listed above) returned an error saying:
ERROR: '~ubuntu-toolchain-r' user or team does not exist.
When I ran
sudo apt update
I get
This did not happen the first time. Does anyone know what is wrong?