Can g++ (gcc) 11.1 be used on Debian Bullseye?
Debian 11 (bullseye) is soon to be released, and I am interested in a compiler with C++20 and modules support.
Debian 11 currently has gcc 10.2 and clang 11. clang 11 has some C++20 support.
Is Debian more conservative with gcc as opposed to clang because the OS uses gcc?
3
Answers
Since the links in the next paragraph are obsolete because Ubuntu 19.04 has reached its end of life, I refer readers of this answer to the more general case which is applicable for all users of gcc in Debian-based operating systems. For more information on installing non-standard versions of gcc and g++ in Debian-based operating systems please refer to this answer.
Here it is, g++-11 from the default Ubuntu repositories ready to install in Debian Bullseye and the package’s dependencies are listed on this page.
Open the terminal and type:
The last command will return a list of missing dependencies which can be found at this webpage. After all the missing dependency packages have been manually downloaded and installed, the command to install the g++-11 package is as follows:
The
apt install --simulate
commands will certainly generate unmet dependencies errors at first because the Debian Bullseye default repositories do not contain the gcc-11 dependency package (gcc-10 is the latest version), but they will show a list of missing dependency packages. If you work at it iteratively you will be able to get all of these missing dependency packages installed, so that in the endsudo apt install ./g++-11_11.1.0-1ubuntu1~21.04_amd64.deb
will run without errors.g++-11, gcc-11 installs OK into ‘Debian 11 Bullseye’.
g++-11 and dependencies …
g++-11 https://packages.debian.org/experimental/g++-11
Install :
cd Downloads/
;# apt install ./*
That matters with your "
Source.list
".if your "source.list" is the "Debian 11: Official sources.list":
(
Debian 11
source withg++(gcc)10
)then "
apt-cache madison gcc
":If your "Source.list" is just like:
(
Debian 11
source withg++(gcc)11
)then "
apt-cache madison gcc
":So, if you want to change your
Debian 11
‘sGCC
from10
to11
,you could change that to your
Debian
"source.list".Just do this below:
And then change
"source.list"
with adding that source which can help you download theg++(gcc)11
. please use the below to replace your Debian source or that offical sources: