The recommended way

Ubuntu 23.04 has both the packages you seem to need and in the versions that you require i.e. gcc-13 and gcc-13-aarch64-linux-gnu in the [security] [universe] repository and Ubuntu 23.10 has them in the [main] repository ... So, my advice would, naturally, be to upgrade your system to Ubuntu 23.04 or even 23.10 and then install your desired packages like so:

sudo apt update && sudo apt install gcc-13 gcc-13-aarch64-linux-gnu

That is the recommended and safest way.

The hacky way

Otherwise, it's the on your own risk way ... e.g. adding a PPA such as you did ... Yep, you have already chosen the "on your own risk way" ... Read this (emphasis is mine):

Adding this PPA to your system

You can update your system with unsupported packages from this untrusted PPA by adding ppa:ubuntu... to your system's Software Sources.

... that text is quoted from the Launchpad link you included in your question and it's not limited to that specific PPA (which might be of good reputation), but it is what it is.

That PPA enables for installing the package gcc-13 on Ubuntu 22.04 by essentially including that package with its dependencies that can not be satisfied from the Ubuntu 22.04 official repositories and of course some other work might be involved like modifying post-install and/or pre-install scripts and ensuring none of the added package or its dependencies will conflict with existing essential system packages and so forth.

In the case of gcc-13 and gcc-13-aarch64-linux-gnu, which are also made available in Ubuntu 23.04/23.10 official repositories, one might ponder the possibility of installing them from 23.04/23.10 repositories on an Ubuntu 22.04 system? ... Well, yeah surely possible (for these two) and it should make the "on your own risk" zone a bit more appealing as those repositories are official and trusted, but the unsupported part will still apply.

Anyway, I have quickly traced those two packages and their dependencies and then installed both from the official repositories of Ubuntu 23.10 on an Ubuntu 22.04 system successfully without any noticeable drawbacks AFAIK ... After all the GNU C compiler is not essential to the functionality of Ubuntu and is offered as an optional package for manual install.

However, there is probably most likely certainly an extremely big problem awaiting if you're not careful enough i.e. you must make sure no other packages from that repository get installed by any means including automatic-updates so turn all those off and fully update your system first, then follow all instructions precisely (still on your own risk of course) ... If other packages got installed, they might break your system so dangerously badly and possible beyond any applicable repair and of course this is as unsupported as your PPA installed packages ... So, we will not provide any support for either.

Needless to say that I don't prefer it or like it this way, but you seem to need it so I wrote it.

The idea is, basically, to add the official Ubuntu repository containing those two packages, refresh the local cached sources list, install those two packages and promptly delete the added repository from you system like so:

First, add the repository:

echo "deb http://cz.archive.ubuntu.com/ubuntu mantic main" |
sudo tee /etc/apt/sources.list.d/temporary-repository.list

Second, update package lists:

sudo apt update

Third, only install gcc-13 and gcc-13-aarch64-linux-gnu:

sudo apt install gcc-13 gcc-13-aarch64-linux-gnu

Fourth, delete that temporary repository:

sudo rm /etc/apt/sources.list.d/temporary-repository.list

Finally, update your cached packages lists:

sudo apt update

Notice

  • You might need to first remove the gcc-13 package you have already installed from that PPA and the PPA itself to avoid possible dependency version mismatch.

  • You'll need to run those by version number i.e. gcc-13 -v and aarch64-linux-gnu-gcc-13 -v and not just gcc or you can use the Ubuntu alternatives system to choose the default version.

Answer from Raffa on askubuntu.com
Top answer
1 of 1
10

The recommended way

Ubuntu 23.04 has both the packages you seem to need and in the versions that you require i.e. gcc-13 and gcc-13-aarch64-linux-gnu in the [security] [universe] repository and Ubuntu 23.10 has them in the [main] repository ... So, my advice would, naturally, be to upgrade your system to Ubuntu 23.04 or even 23.10 and then install your desired packages like so:

sudo apt update && sudo apt install gcc-13 gcc-13-aarch64-linux-gnu

That is the recommended and safest way.

The hacky way

Otherwise, it's the on your own risk way ... e.g. adding a PPA such as you did ... Yep, you have already chosen the "on your own risk way" ... Read this (emphasis is mine):

Adding this PPA to your system

You can update your system with unsupported packages from this untrusted PPA by adding ppa:ubuntu... to your system's Software Sources.

... that text is quoted from the Launchpad link you included in your question and it's not limited to that specific PPA (which might be of good reputation), but it is what it is.

That PPA enables for installing the package gcc-13 on Ubuntu 22.04 by essentially including that package with its dependencies that can not be satisfied from the Ubuntu 22.04 official repositories and of course some other work might be involved like modifying post-install and/or pre-install scripts and ensuring none of the added package or its dependencies will conflict with existing essential system packages and so forth.

In the case of gcc-13 and gcc-13-aarch64-linux-gnu, which are also made available in Ubuntu 23.04/23.10 official repositories, one might ponder the possibility of installing them from 23.04/23.10 repositories on an Ubuntu 22.04 system? ... Well, yeah surely possible (for these two) and it should make the "on your own risk" zone a bit more appealing as those repositories are official and trusted, but the unsupported part will still apply.

Anyway, I have quickly traced those two packages and their dependencies and then installed both from the official repositories of Ubuntu 23.10 on an Ubuntu 22.04 system successfully without any noticeable drawbacks AFAIK ... After all the GNU C compiler is not essential to the functionality of Ubuntu and is offered as an optional package for manual install.

However, there is probably most likely certainly an extremely big problem awaiting if you're not careful enough i.e. you must make sure no other packages from that repository get installed by any means including automatic-updates so turn all those off and fully update your system first, then follow all instructions precisely (still on your own risk of course) ... If other packages got installed, they might break your system so dangerously badly and possible beyond any applicable repair and of course this is as unsupported as your PPA installed packages ... So, we will not provide any support for either.

Needless to say that I don't prefer it or like it this way, but you seem to need it so I wrote it.

The idea is, basically, to add the official Ubuntu repository containing those two packages, refresh the local cached sources list, install those two packages and promptly delete the added repository from you system like so:

First, add the repository:

echo "deb http://cz.archive.ubuntu.com/ubuntu mantic main" |
sudo tee /etc/apt/sources.list.d/temporary-repository.list

Second, update package lists:

sudo apt update

Third, only install gcc-13 and gcc-13-aarch64-linux-gnu:

sudo apt install gcc-13 gcc-13-aarch64-linux-gnu

Fourth, delete that temporary repository:

sudo rm /etc/apt/sources.list.d/temporary-repository.list

Finally, update your cached packages lists:

sudo apt update

Notice

  • You might need to first remove the gcc-13 package you have already installed from that PPA and the PPA itself to avoid possible dependency version mismatch.

  • You'll need to run those by version number i.e. gcc-13 -v and aarch64-linux-gnu-gcc-13 -v and not just gcc or you can use the Ubuntu alternatives system to choose the default version.

🌐
Ubuntu
launchpad.net › ubuntu › +source › gcc-13
gcc-13 package in Ubuntu
gnueabihf g++-13-for-build: GNU C++ compiler for the build architecture g++-13-for-host: GNU C++ compiler for the host architecture g++-13- ... gnueabihf gcc-13-base: GCC, the GNU Compiler Collection (base package) gcc-13-doc: Documentation for the GNU compilers (gcc, gobjc, g++) gcc-13-for-build: GNU C compiler for the build architecture gcc-13-for-host: GNU C compiler for the host architecture gcc-13-
Discussions

c++ - Installing GCC-13 on Ubuntu 22.04 - Stack Overflow
Has anyone successfully installed gcc-13 on Ubuntu 22.04? Looking to use some newer C++20 features that do not appear to be supported on the current default build (gcc-11.3) There does not appear ... More on stackoverflow.com
🌐 stackoverflow.com
GCC 13.2 update Ubuntu
GCC 13 is available through the gcc-13 package in Ubuntu 23.04 or newer. More on reddit.com
🌐 r/Ubuntu
7
1
September 18, 2023
[linuxbrew] gcc-13 doesn't work on an Ubuntu distribution which targets glibc 2.31
I assume that it was because homebrew binutils is key-only, so that homebrew gcc-13 cound not find /home/linuxbrew/.linuxbrew/bin/ld and failed back to system /usr/bin/ld. More on github.com
🌐 github.com
44
June 27, 2023
GCC issues with Ubuntu 22.04 and mainline kernel
The Ubuntu Kernel team has started compiling the mainline kernel with gcc-13 as of versions 6.4.4 and 6.5-rc3. I don’t know what’s driving this change—i.e. if it’s coming from upstream or if it was an internal decision—or if they plan to revisit it. More on forum.level1techs.com
🌐 forum.level1techs.com
0
0
July 27, 2023
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › reference › availability › gcc
Available GCC versions - Ubuntu for Developers
April 5, 2026 - This page lists GCC versions available in Ubuntu releases. Ubuntu GCC (deb) packages:,,, Ubuntu version, available GCC versions, gcc-defaults version,,, 25.10 (Questing Quokka), 11, 12, 13, 14, 15,...
🌐
Stack Overflow
stackoverflow.com › questions › 76168157 › installing-gcc-13-on-ubuntu-22-04
c++ - Installing GCC-13 on Ubuntu 22.04 - Stack Overflow
(There is/was a PPA with builds and backports I have used in the past but it doesn't always have all one wants. See launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/ppa ) ... I have had success building my own gcc-13 on Ubuntu Jammy 22.04.2. Check out my GitHub script.
🌐
DEV Community
dev.to › nullity › zai-ubuntu-2004-an-zhuang-gcc-13-1kd1
Install or uninstall gcc 13 on Ubuntu 20.04 - DEV Community
March 22, 2024 - sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt update sudo apt install gcc-13 g++-13
🌐
Developernote
developernote.com › 2023 › 08 › installing-gcc13-on-ubuntu-22-04
Installing GCC13 on Ubuntu 22.04 | DeveloperNote.com
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt update sudo apt install gcc-13 g++-13 ll /usr/bin/gcc-13 ll /usr/bin/g++-13 update-alternatives --display gcc ll /etc/alternatives/g* sudo update-alternatives --remove-all gcc sudo update-alternatives --remove-all g++ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13 g++ --version gcc --version
🌐
Ubuntu
packages.ubuntu.com › noble › gcc-13
Ubuntu – Details of package gcc-13 in noble
dep: gcc-13-base (= 13.2.0-23ubuntu4) [not amd64, i386] GCC, the GNU Compiler Collection (base package) dep: gcc-13-base (= 13.3.0-6ubuntu2~24.04) [amd64, i386] dep: gcc-13-i686-linux-gnu (= 13.3.0-6ubuntu2~24.04) [i386] GNU C compiler for the i686-linux-gnu architecture ·
Find elsewhere
🌐
LinuxCapable
linuxcapable.com › home › ubuntu › how to install gcc on ubuntu 26.04, 24.04 and 22.04
How to Install GCC on Ubuntu 26.04, 24.04 and 22.04 - LinuxCapable
1 week ago - Use the default Ubuntu repositories for normal development because they track each release’s tested compiler stack. Ubuntu 26.04 defaults to GCC 15.x, Ubuntu 24.04 defaults to GCC 13.x, and Ubuntu 22.04 defaults to GCC 11.x.
🌐
DedicatedCore
dedicatedcore.com › home › how to install gcc compiler on ubuntu 22.04
How to Install GCC Compiler on Ubuntu 22.04 - DedicatedCore Blog
January 24, 2025 - Use the command below to update the Ubuntu package repository: ... The GCC compiler, along with other tools needed for software development, is included in the build-essential package. ... In this case, the GCC version is 11.4.0. Users can install a certain GCC version (or multiple GCC versions) quickly and easily by using GCC PPAs (Personal Package Archives). ... Use the command listed below to install one or more GCC versions. For instance, type: to install GCC 12 and GCC 13...
🌐
Nilo Menezes
blog.nilo.pro.br › en › posts › 2024-04-18-compilando-o-gcc-13-2-0-no-ubuntu-22-04-lts
Compiling the GCC 13.2.0 on Ubuntu 22.04 LTS :: Nilo Menezes
April 18, 2024 - $ gcc-13 --version gcc-13 (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0 Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install gcc compiler on ubuntu
How to Install GCC Compiler on Ubuntu {3 Simple Methods}
February 20, 2025 - To install the GCC compiler from Ubuntu repositories: ... The build-essential package includes the GCC compiler and other utilities required for building software. 3. Use the following command to check the GCC version: ... The GCC version in this example is 13.3.0.
🌐
Ubuntu
launchpad.net › ubuntu › +source › gcc-13 › 13.2.0-7ubuntu1
gcc-13 13.2.0-7ubuntu1 source package in Ubuntu - Launchpad
No description available for g++-13-dbgsym in ubuntu noble. g++-13-multilib: GNU C++ compiler (multilib support) This is the GNU C++ compiler, a fairly portable optimizing compiler for C++. . This is a dependency package, depending on development ...
🌐
Ubuntu
archive.ubuntu.com › ubuntu › pool › universe › g › gcc-13
Index of /ubuntu/pool/universe/g/gcc-13
Index of /ubuntu/pool/universe/g/gcc-13 · Apache/2.4.52 (Ubuntu) Server at archive.ubuntu.com Port 80
🌐
Lindevs
lindevs.com › install-gcc-on-ubuntu
Install gcc 13 on Ubuntu 22.04 | Lindevs
October 29, 2023 - This tutorial demonstrates how to install gcc 13 on Ubuntu 22.04.
🌐
GitHub
github.com › Homebrew › homebrew-core › issues › 135068
[linuxbrew] gcc-13 doesn't work on an Ubuntu distribution which targets glibc 2.31 · Issue #135068 · Homebrew/homebrew-core
June 27, 2023 - I assume that it was because homebrew binutils is key-only, so that homebrew gcc-13 cound not find /home/linuxbrew/.linuxbrew/bin/ld and failed back to system /usr/bin/ld.
Author   CarterLi
🌐
Snapcraft
snapcraft.io › install › gcc-13 › ubuntu
Install gcc-13 on Ubuntu using the Snap Store | Snapcraft
May 26, 2025 - Get the latest version of gcc-13 for on Ubuntu - the GNU Compiler Collection version 13.
🌐
Ubuntu
pl.archive.ubuntu.com › ubuntu › pool › main › g › gcc-13
Index of /ubuntu/pool/main/g/gcc-13
Index of /ubuntu/pool/main/g/gcc-13 · Apache/2.4.58 (Ubuntu) Server at pl.archive.ubuntu.com Port 443
🌐
Level1Techs
forum.level1techs.com › operating systems & open source › linux
GCC issues with Ubuntu 22.04 and mainline kernel - Linux - Level1Techs Forums
July 27, 2023 - The Ubuntu Kernel team has started compiling the mainline kernel with gcc-13 as of versions 6.4.4 and 6.5-rc3. I don’t know what’s driving this change—i.e. if it’s coming from upstream or if it was an internal decision—or if they plan to revisit it.