skip to Main Content

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


  1. 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:

    cd ~/Desktop/
    wget http://security.ubuntu.com/ubuntu/pool/universe/g/gcc-11/g++-11_11.1.0-1ubuntu1~21.04_amd64.deb
    apt install --simulate ./g++-11_11.1.0-1ubuntu1~21.04_amd64.deb
    

    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:

    sudo apt install ./g++-11_11.1.0-1ubuntu1~21.04_amd64.deb 
    

    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 end sudo apt install ./g++-11_11.1.0-1ubuntu1~21.04_amd64.deb will run without errors.

    Login or Signup to reply.
  2. g++-11, gcc-11 installs OK into ‘Debian 11 Bullseye’.

    g++-11 and dependencies …

    cpp-11_11.1.0-4_amd64.deb
    g++-11_11.1.0-4_amd64.deb
    gcc-11_11.1.0-4_amd64.deb
    gcc-11-base_11.1.0-4_amd64.deb
    libasan6_11.1.0-4_amd64.deb
    libatomic1_11.1.0-4_amd64.deb
    libcc1-0_11.1.0-4_amd64.deb
    libgcc-11-dev_11.1.0-4_amd64.deb
    libgcc-s1_11.1.0-4_amd64.deb
    libgomp1_11.1.0-4_amd64.deb
    libitm1_11.1.0-4_amd64.deb
    liblsan0_11.1.0-4_amd64.deb
    libquadmath0_11.1.0-4_amd64.deb
    libstdc++-11-dev_11.1.0-4_amd64.deb
    libstdc++6_11.1.0-4_amd64.deb
    libtsan0_11.1.0-4_amd64.deb
    libubsan1_11.1.0-4_amd64.deb
    

    g++-11 https://packages.debian.org/experimental/g++-11

    Install : cd Downloads/ ; # apt install ./*

    Login or Signup to reply.
  3. That matters with your "Source.list".

    if your "source.list" is the "Debian 11: Official sources.list":

    (Debian 11 source with g++(gcc)10)

    deb http://deb.debian.org/debian/ bullseye main
    deb-src http://deb.debian.org/debian/ bullseye main
    deb http://security.debian.org/debian-security bullseye-security main contrib
    deb-src http://security.debian.org/debian-security bullseye-security main contrib
    deb http://deb.debian.org/debian/ bullseye-updates main contrib
    deb-src http://deb.debian.org/debian/ bullseye-updates main contrib
    

    then "apt-cache madison gcc":

    gcc | 4:10.2.1-1 | http://deb.debian.org/debian bullseye/main amd64 Packages
    
    gcc-defaults |      1.190 | http://deb.debian.org/debian bullseye/main Sources
    

    If your "Source.list" is just like:

    (Debian 11 source with g++(gcc)11)

    deb http://mirrors.xmission.com/debian/ testing main non-free contrib
    
    deb http://http.us.debian.org/debian testing main contrib non-free
    
    deb http://ftp.us.debian.org/debian testing main non-free contrib
    

    then "apt-cache madison gcc":

    gcc | 4:11.2.0-2 | http://mirrors.xmission.com/debian testing/main amd64 Packages
    
    gcc | 4:11.2.0-2 | http://http.us.debian.org/debian testing/main amd64 Packages
    
    gcc | 4:11.2.0-2 | http://ftp.us.debian.org/debian testing/main amd64 Packages
    

    So, if you want to change your Debian 11‘s GCC from 10 to 11,

    you could change that to your Debian "source.list".

    Just do this below:

    cd /etc/apt/ && sudo nano sources.list
    

    And then change "source.list" with adding that source which can help you download the g++(gcc)11. please use the below to replace your Debian source or that offical sources:

    deb http://mirrors.xmission.com/debian/ testing main non-free contrib
    deb http://http.us.debian.org/debian testing main contrib non-free
    deb http://ftp.us.debian.org/debian testing main non-free contrib
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search