gcc-7
and gcc-8
will happily co-live together.
I would suggest to let gcc-7
be installed, for satisfying build-essential
and perhaps other dependent packages, and configure gcc-8
to be your default gcc installation.
Use update-alternatives
for having gcc
redirected automatically to gcc-8
:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
This will give you the convenience of gcc being at the latest version, and still you will be able to invoke gcc-7
or gcc-8
directly.
If you'll wish to change the default gcc version later on, run sudo update-alternatives --config gcc
. It will bring a prompt similar to this, which lets you pick the version to be used:
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-8 800 auto mode
1 /usr/bin/gcc-7 700 manual mode
2 /usr/bin/gcc-8 800 manual mode
Press <enter> to keep the current choice[*], or type selection number:
The higher priority is the one that is picked automatically by update-alternatives
.
build-essential
but the other packages it depend on directly?dpkg-dev g++-8 gcc-8 libc6-dev libc-dev make
g++-4.8 g++-5 g++-6 g++-8
... ... g++-7/gcc-7 is the system compiler. The older versions are required for building some older applications.