Downgrade GNU Compilers Ubuntu 18.04

update-alternatives gives you the convenience of switching between different installed gcc versions. Downgrading the system gcc is almost never needed, and is generally harmful.

The error /usr/bin/gcc-6 doesn't exist from update-alternatives suggests that gcc-6 is not installed, so all you need is to install the following packages (which are found in the default 18.04 repository, bionic/universe):

sudo apt-get install gcc-6 g++-6 g++-6-multilib gfortran-6

Then, repeat the sudo update-alternatives --install step for each gcc version you wish to use.

Whenever you want to change back gcc to point to the default version shipped with Bionic, 7.3, simply run sudo update-alternatives --config gcc, which will let you pick between the available gcc versions with installed alternatives.

Also, you can always run a specific gcc version directly, by specifying the version suffix (gcc-6, gcc-7, etc).

Tags:

Gcc

Downgrade