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.

Discussions

build kernel with aarch64-linux-gnu-gcc - Stack Overflow
I am trying to build the kernel source on my platform with the following command: make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- generic-v8-defconfig However, the error messages appear as shown in... More on stackoverflow.com
🌐 stackoverflow.com
ARM GNU-A toolchain not needed on Linux
Thanks for sharing this great project! It's really amazing to be able to build & run bare metal C++ programs on my Raspberry Pi. I just discovered while trying to build the sample projects ... More on github.com
🌐 github.com
12
August 4, 2020
gcc - How to install the aarch64 toolchain for armv8 cortex-a53 on Debian? - Stack Overflow
I'm wanting to start low level programming on ARM chips. I've installed qemu and followed a few example programs for hello world type stuff, but now I want to target the latest Raspberry Pi, which ... More on stackoverflow.com
🌐 stackoverflow.com
how to build ubuntu for arm64? (how to give ARCH and CROSS_COMPILE variable to `debian/rules` command) - Unix & Linux Stack Exchange
someone suggested me this would be the right place for asking this question and it seems so from other questions. I hope to get an answer here. (by the way, the reason I'm trying to build ubuntu is... More on unix.stackexchange.com
🌐 unix.stackexchange.com
🌐
Xpack-dev-tools
xpack-dev-tools.github.io › installation guide
Installation Guide | xPack GNU AArch64 Embedded GCC
For older development environments, it is also possible to install xPack GNU AArch64 Embedded GCC only globally in the user's global xPacks store, without any local links/forwarders; it is the developer's responsibility to configure the path to the tools. No other files are installed in any system folders or other locations. xpm install @xpack-dev-tools/aarch64-none-elf-gcc@latest --global --verbose
🌐
GitHub
github.com › xpack-dev-tools › aarch64-none-elf-gcc-xpack
GitHub - xpack-dev-tools/aarch64-none-elf-gcc-xpack: A binary distribution of the AArch64 Embedded GCC toolchain · GitHub
A standalone, cross-platform (Windows, macOS, GNU/Linux) binary distribution of GNU AArch64 Embedded GCC, intended for reproducible builds. For information on how to install and use this project, please refer to the project website.
Author   xpack-dev-tools
🌐
GitHub
github.com › xpack-dev-tools › aarch64-none-elf-gcc-xpack › releases
Releases · xpack-dev-tools/aarch64-none-elf-gcc-xpack
A binary distribution of the AArch64 Embedded GCC toolchain - Releases · xpack-dev-tools/aarch64-none-elf-gcc-xpack
Author   xpack-dev-tools
🌐
Github
xpack.github.io › blog › 2022 › 05 › 31 › aarch64-none-elf-gcc-v11-2-1-1-2-released
xPack GNU AArch64 Embedded GCC v11.2.1-1.2 released | The xPack Build Framework
June 21, 2024 - The full details of installing the xPack GNU AArch64 Embedded GCC on various platforms are presented in the separate Install page. The easiest way to install Arm Embedded GCC is with xpm by using the binary xPack, available as @xpack-dev-tools/aarch64-none-elf-gcc from the npmjs.com registry.
🌐
GitHub
github.com › rsta2 › circle › issues › 126
ARM GNU-A toolchain not needed on Linux · Issue #126 · rsta2/circle
August 4, 2020 - I just discovered while trying to build the sample projects that the ARM GNU-A toolchain download does not seem to be necessary when running on Ubuntu 18.04 (LTS), 19.10 or 20.4. What I did instead was to install: ... I then modified Config.mk to contain PREFIX64 = aarch64-linux-gnu- instead of aarch64-none-elf-. This worked like a charm, with the generated binaries booting fine on my Raspberry Pi 3 B (at least for the "10-usbmouse", "17-fractal" & "26-cpustress" samples I tested).
Author   forderud
Find elsewhere
🌐
Arch Linux
aur.archlinux.org › packages › aarch64-none-elf-gcc-bin
AUR (en) - aarch64-none-elf-gcc-bin - Arch Linux
March 8, 2026 - https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-aarch64-none-elf.tar.xz
🌐
Ubuntu
packages.ubuntu.com › bionic › devel › gcc-aarch64-linux-gnu
Ubuntu – Error
two or more packages specified (gcc-aarch64-linux-gnu bionic) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
🌐
Alpine Linux
pkgs.alpinelinux.org › package › edge › community › aarch64 › gcc-aarch64-none-elf
gcc-aarch64-none-elf - Alpine Linux packages
cmd:aarch64-none-elf-gcc · cmd:aarch64-none-elf-gcov-dump · cmd:aarch64-none-elf-gcov-tool · cmd:aarch64-none-elf-gcov · cmd:aarch64-none-elf-lto-dump · Install if (0) None
Top answer
1 of 2
10

As of Ubuntu 18.04 you can do:

sudo apt-get install gcc-aarch64-linux-gnu
aarch64-linux-gnu-gcc -mcpu=cortex-a53 hello_world.c

The package gcc-aarch64-linux-gnu is at version 4:7.3.0-3ubuntu2

However, for Raspberry Pi, you should just download the official binaries from https://github.com/raspberrypi/tools which is the more reliable way to do it as explained at: https://raspberrypi.stackexchange.com/questions/64273/installing-raspberry-pi-cross-compiler/83215#83215

Finally, for bare metal, I was not able to find the analogue of arm-none-eabi-gcc, I wonder why: https://github.com/cirosantilli/cirosantilli.github.io/issues/68

2 of 2
2

You can try my Latest Pre-Built Open-Sourced GCC Toolchains for Raspberry Pi from this Github Project:

This Project Summary: This project contains the UpToDate set of Precompiled/Pre-Built Raspberry pi GCC Cross & Native Compilers Binaries, saving your tons of time(No compiling or Error Handling needed whatsoever). Just Extract, Link & Enjoy complete GCC(Raspberry Pi) functionality in your Machine. You can use its native compilers for Raspberry Pi(Can be used along with old & slow 6.3.0 GCC), Or use the Cross-Compiler in any Linux Machine(Tested on Latest Ubuntu/bionic x64) to compile programs for your Raspberry Pi. All these compilers binaries are Raspberry Pi hardware optimized for enhanced overall performance.

The Supported GCC Versions are:

  • GCC 6.3.0
  • GCC 7.4.0
  • GCC 8.2.0
  • GCC 8.3.0

Supported Environments:

  • Cross-Compiler: All Linux Distros (x32/x64) are currently supported.
  • Native-Compiler: All Raspberry Pi version/model with Raspbian OS is supported. Other OS may/may-not work.

Hope that helps! :)

🌐
Github
xpack.github.io › blog › 2022 › 05 › 15 › aarch64-none-elf-gcc-v11-2-1-1-1-released
xPack GNU AArch64 Embedded GCC v11.2.1-1.1 released | The xPack Build Framework
August 3, 2024 - The full details of installing the xPack GNU AArch64 Embedded GCC on various platforms are presented in the separate Install page. The easiest way to install Arm Embedded GCC is with xpm by using the binary xPack, available as @xpack-dev-tools/aarch64-none-elf-gcc from the npmjs.com registry.
🌐
Ubuntu
launchpad.net › ubuntu › jammy › +package › gcc-aarch64-linux-gnu
gcc-aarch64-linux-gnu : Jammy (22.04) : Ubuntu
gcc-defaults 1.193ubuntu1 source package in Ubuntu · gcc-aarch64-linux-gnu 4:11.2.0-1ubuntu1 in amd64 (Release)
🌐
GitHub
github.com › isometimes › rpi4-osdev › issues › 12
[SOLVED] Building on linux arm · Issue #12 · babbleberry/rpi4-osdev
May 11, 2021 - I'm following this (pretty amazing) ... or ubuntu pc. However, the building part is an issue. I've downloaded the "AArch64 ELF bare-metal target" for aarch64 but it doesn't work. Any idea on why? Thanks in advance! ... /bin/rm kernel8.elf *.o *.img > /dev/null 2> /dev/null || true gcc-arm-compiler/bin/aarch64-none-elf-gcc -Wall ...
🌐
GitHub
github.com › Haseo97 › aarch64-elf-gcc › blob › master › share › info › gccinstall.info
aarch64-elf-gcc/share/info/gccinstall.info at master · Haseo97/aarch64-elf-gcc
Latest stable GCC 9.1.0 built using the latest binutils 2.32 for bare-metal target (AArch64 ELF) - aarch64-elf-gcc/share/info/gccinstall.info at master · Haseo97/aarch64-elf-gcc
Author   Haseo97
🌐
Arch Linux
aur.archlinux.org › packages › aarch64-none-elf-toolchain
AUR (en) - aarch64-none-elf-toolchain - Arch Linux
You don't need two gcc packages (one for bootstrap, and one for the final one) What's the reason for 1 -toolchain package versus 3 for the components separately? ... [...] make[2]: Verzeichnis „/home/chris/.cache/pikaur/build/aarch64-none-elf-toolchain/src/obj/libctf“ wird verlassen CCLD as-new config.lt: creating libtool checking whether g++ supports C++11 features by default...
🌐
Stack Exchange
unix.stackexchange.com › questions › 656263 › how-to-build-ubuntu-for-arm64-how-to-give-arch-and-cross-compile-variable-to
how to build ubuntu for arm64? (how to give ARCH and CROSS_COMPILE variable to `debian/rules` command) - Unix & Linux Stack Exchange
Thanks! when I give export $(dpkg-architecutre -aarm64) I get ` dpkg-architecture: warning: specified GNU system type aarch64-linux-gnu does not match CC system type x86_64-linux-gnu, try setting a correct CC environment variable`. I ignore this and do the build, then I get : check-config: FAIL (- != y): CONFIG_STACKPROTECTOR_PER_TASK policy<{'arm64': 'y'}>. ... For those interested : I had to download the gcc for aarch64 from arm to remove that CONFIG_STACKPROTECTOR_PER_TASK related errors.
🌐
Qt Forum
forum.qt.io › home › qt development › installation and deployment › using cross-compilation for arm64 in the ubuntu 24.04 x86 environment
Using cross-compilation for ARM64 in the Ubuntu 24.04 x86 environment | Qt Forum
March 12, 2025 - sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu $ which aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc $ aarch64-linux-gnu-gcc --version aarch64-linux-gnu-gcc (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0 Copyright (C) 2023 Free ...