Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When gcc-11 will appear in Ubuntu repositories? [closed]

GCC 11.1 was finally released yesterday. However, now it can only be built from source, so I'm wondering when we can get it with apt?

like image 911
gavrilikhin.d Avatar asked Apr 28 '21 10:04

gavrilikhin.d


People also ask

What is the latest version of GCC for Ubuntu?

The latest version of GCC, which is 9.1. 0 is available from the Ubuntu Toolchain PPA.

Does GCC come preinstalled with Ubuntu?

The gcc package is installed by default on all Ubuntu desktop flavors.

What version of GCC is installed in Ubuntu?

You now have GCC 11.1 installed in Ubuntu. Not the answer you're looking for? Browse other questions tagged ubuntu gcc apt gcc11 or ask your own question.

What is GCC 11?

The gcc is a compiler of the GNU Compiler Collection (GCC). The gcc compiler is mainly used to compile C programs. This tutorial demonstrates how to install gcc 11 on Ubuntu 20.04.

How do I fix gcc build errors from casachii?

If you run into any issues building GCC yourself using the instructions from casachii, such as build errors reporting missing GMP, MPFR, MPC, etc, then simply do the following: From the GCC directory (the parent of the "build" directory you just created), run: Finally go back into your build directory as casachii instructs and build GCC 11.x

What is gcc-11-powerpc64-Linux-GNU impish?

Package gcc-11-powerpc64-linux-gnu impish (21.10)(devel): GNU C compiler (cross compiler for ppc64 architecture) [universe] 11.2.0-3ubuntu1cross1: amd64 i386


Video Answer


2 Answers

sudo apt install build-essential manpages-dev software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update && sudo apt install gcc-11 g++-11

Then use update-alternatives to set default gcc...

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-9 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-9  --slave /usr/bin/cpp cpp /usr/bin/cpp-9 && \

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11  --slave /usr/bin/cpp cpp /usr/bin/cpp-11;

To sample check settings to see which gcc is default you can run the following, if they show correct resuslts then the rest are fine...

gcc --version;g++ --version;gcov --version;

To reconfigure to any previous gcc version...

sudo update-alternatives --config gcc

You can do this on any version of ubuntu,... enjoy!

Here are my 6 different gcc's living side by side with the default being gcc-11:

$ sudo update-alternatives --config gcc
There are 6 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path             Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gcc-11   1010      auto mode
  1            /usr/bin/gcc-10   1000      manual mode
  2            /usr/bin/gcc-11   1010      manual mode
  3            /usr/bin/gcc-5    40        manual mode
  4            /usr/bin/gcc-7    700       manual mode
  5            /usr/bin/gcc-8    800       manual mode
  6            /usr/bin/gcc-9    900       manual mode

Press <enter> to keep the current choice[*], or type selection number:
like image 166
DanglingPointer Avatar answered Oct 09 '22 01:10

DanglingPointer


On Ubuntu 20.04, I followed the instructions here:

  • https://packages.ubuntu.com/hirsute/amd64/gcc-11-multilib/download

Which is to:

  1. Update the listed mirrors by adding a line to your /etc/apt/sources.list like this:

    sudo add-apt-repository 'deb http://mirrors.kernel.org/ubuntu hirsute main universe'

    Choose a mirror based on your location from the list. I chose the kernel mirror as I am in North America.

  2. sudo apt-get update

  3. sudo apt-get install gcc-11

After that which gcc-11 should produce a path to gcc-11. On my machine it was:

which gcc-11

produces: /usr/bin/gcc-11

like image 26
William Roberts Avatar answered Oct 08 '22 23:10

William Roberts