I suggest you try to build the toolchain from sources. It's easy with an open source tool called crosstool-ng. This method requires more time, but allows configuration of the toolchain and usually works well even if you use some old or uncommon system.

In order to install ct-ng, follow the instructions here: https://crosstool-ng.github.io/docs/install/

The tool has a sample called aarch64-unknown-linux-gnu and it looks like the toolchain you need (to list all samples use ct-ng list-samples).

In order to initialize the configuration run:

ct-ng aarch64-unknown-linux-gnu

Then you can ct-ng nconfig to select specific options that you want to change. For example, you may want to change the version of GCC. You mentioned 7. So, select C compiler then Version of gcc and pick the one that you want. There should be several versions available.

When you're done selecting the options, run:

ct-ng build

In order to modify more things, for example the place where the toolchain shall be stored, you can use the docs: https://crosstool-ng.github.io/docs/configuration/

Answer from user on Stack Exchange
🌐
GitHub
github.com › actions › runner-images › issues › 3892
Add [g++ or gcc] for aarch64 and arm on ubuntu · Issue #3892 · actions/runner-images
August 13, 2021 - apt install -y g++-aarch64-linux-gnu apt install -y g++-arm-linux-gnueabi # apt install -y gcc-aarch64-linux-gnu # apt install -y gcc-arm-linux-gnueabi
Author   anatawa12
Top answer
1 of 2
1

I suggest you try to build the toolchain from sources. It's easy with an open source tool called crosstool-ng. This method requires more time, but allows configuration of the toolchain and usually works well even if you use some old or uncommon system.

In order to install ct-ng, follow the instructions here: https://crosstool-ng.github.io/docs/install/

The tool has a sample called aarch64-unknown-linux-gnu and it looks like the toolchain you need (to list all samples use ct-ng list-samples).

In order to initialize the configuration run:

ct-ng aarch64-unknown-linux-gnu

Then you can ct-ng nconfig to select specific options that you want to change. For example, you may want to change the version of GCC. You mentioned 7. So, select C compiler then Version of gcc and pick the one that you want. There should be several versions available.

When you're done selecting the options, run:

ct-ng build

In order to modify more things, for example the place where the toolchain shall be stored, you can use the docs: https://crosstool-ng.github.io/docs/configuration/

2 of 2
0

You can just try using them by downloading the .deb files for those packages from the Ubuntu site and installing them manually via dpkg:

Download the packages:

wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-7-cross/gcc-7-aarch64-linux-gnu-base_7.5.0-3ubuntu1~18.04cross1_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/g/gcc-7-cross/g++-7-aarch64-linux-gnu_7.5.0-3ubuntu1~18.04cross1_amd64.deb

Install them with dependencies via gdebi:

First, install `gdebi if you don't have it:

sudo apt install gdebi-core

Then, you can install both packages with their dependencies using gdebi:

sudo gdebi -i gcc-7-aarch64-linux-gnu-base_7.5.0-3ubuntu1~18.04cross1_amd64.deb
sudo gdebi -i g++-7-aarch64-linux-gnu_7.5.0-3ubuntu1~18.04cross1_amd64.deb

Just because it's not in the default apt repositories for 16.04, doesn't mean you can't go and get the packages yourself (be aware that they may not run or install properly on your older system though).

🌐
GitHub
github.com › najahiiii › aarch64-linux-gnu
GitHub - najahiiii/aarch64-linux-gnu: GNU GCC Toolchain
sudo apt install software-properties-common curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash sudo apt install git-lfs · Date · Variant · Arch · Version · Repo Link · Clone · Status · 16/03/2019 ...
Starred by 11 users
Forked by 12 users
🌐
Ubuntu
launchpad.net › ubuntu › jammy › +package › gcc-aarch64-linux-gnu
gcc-aarch64-linux-gnu : Jammy (22.04) : Ubuntu
This is the GNU C compiler, a fairly portable optimizing compiler for C. . This is a dependency package providing the default GNU C cross-compiler for the arm64 architecture. gcc-defaults 1.193ubuntu1 source package in Ubuntu · gcc-aarch64-linux-gnu 4:11.2.0-1ubuntu1 in amd64 (Release)
🌐
GitHub
github.com › dopaemon › aarch64-linux-gnu
GitHub - dopaemon/aarch64-linux-gnu: GCC arm64
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt-get update · sudo apt-get install flex bison ncurses-dev texinfo gcc gperf patch libtool automake g++ libncurses5-dev gawk subversion expat libexpat1-dev python-all-dev binutils-dev bc libcap-dev autoconf libgmp-dev build-essential pkg-config libmpc-dev libmpfr-dev autopoint gettext txt2man liblzma-dev libssl-dev libz-dev mercurial wget tar gcc-10 g++-10 zstd --fix-broken --fix-missing
Author   dopaemon
🌐
GitHub
github.com › radcolor › aarch64-linux-gnu
GitHub - radcolor/aarch64-linux-gnu: Bleeding edge GNU GCC toolchain (CC only) built from sources using latest binutils and glibc · GitHub
Built with Support for Link Time ... currently we don't have any mirror or a archived release. $ git clone https://github.com/theradcolor/aarch64-linux-gnu --depth=1...
Starred by 32 users
Forked by 15 users
Languages   C++ 47.2% | C 38.5% | Roff 11.3% | Perl 1.8% | Python 0.4% | XC 0.3%
Find elsewhere
🌐
Ubuntu
packages.ubuntu.com › focal › gcc-aarch64-linux-gnu
Details of package gcc-aarch64-linux-gnu in focal
two or more packages specified (gcc-aarch64-linux-gnu focal) Content Copyright © 2026 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
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.

🌐
Howtoinstall.me
howtoinstall.me › ubuntu › 18-04 › gcc-aarch64-linux-gnu
How to Install gcc-aarch64-linux-gnu in Ubuntu 18.04
Ubuntu · 18.04 · gcc-aarch64-linux-gnu · Install gcc-aarch64-linux-gnu by entering the following commands in the terminal: sudo apt update sudo apt install gcc-aarch64-linux-gnu · Description: GNU C compiler for the arm64 architecture · This is the GNU C compiler, a fairly portable optimizing ...
🌐
GitHub
github.com › xootkama › aarch64-linux-gnu-1
GitHub - xootkama/aarch64-linux-gnu-1: GNU GCC Toolchain
sudo apt install software-properties-common curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash sudo apt install git-lfs · Date · Variant · Arch · Version · Repo Link · Clone · Status · 16/03/2019 ...
Author   xootkama
🌐
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.
🌐
Xpack-dev-tools
xpack-dev-tools.github.io › aarch64-none-elf-gcc-xpack › blog › 2023 › 11 › 08 › aarch64-none-elf-gcc-v13-2-1-1-1-released
Version 13.2.1-1.1 released | xPack GNU AArch64 Embedded GCC
November 8, 2023 - The xPack GNU AArch64 Embedded GCC is a standalone cross-platform binary distribution of Arm GNU Toolchain. There are separate binaries for Windows (x64), macOS (x64, arm64) and GNU/Linux (x64, arm64 and arm). ... The main targets for the GNU/Linux Arm binaries are the Raspberry Pi class devices (armv7l and aarch64; armv6 is not supported). The binary files are available from GitHub Releases. x64 GNU/Linux: any system with GLIBC 2.27 or higher (like Ubuntu 18 or later, Debian 10 or later, RedHat 8 or later, Fedora 29 or later, etc)
🌐
Xpack-dev-tools
xpack-dev-tools.github.io › installation guide
Installation Guide | xPack GNU AArch64 Embedded GCC
mkdir -p ~/.local/xPacks/aarch64-none-elf-gcc cd ~/.local/xPacks/aarch64-none-elf-gcc tar xvf ~/Downloads/xpack-aarch64-none-elf-gcc-15.2.1-1.1-linux-x64.tar.gz chmod -R -w xpack-aarch64-none-elf-gcc-15.2.1-1.1 ... For manual installations, the recommended installation location is slightly different from the folders created by xpm install, which utilise the @xpack-dev-tools scope to group different tools, and .content to store the unpacked archive. To verify if the xPack GNU AArch64 Embedded GCC installed manually starts correctly, utilise something such as:
🌐
GitHub
github.com › topics › aarch64-linux-gnu
aarch64-linux-gnu · GitHub Topics · GitHub
android toolchain raspberry-pi kernel compiler raspberrypi gcc sphinx gcc-complier elf aarch64 raspberry-pi-3 android-toolchain gcc-arm-toolchain aarch64-linux-gnu gcc10 rpi4 raspberry-pi-4 gcc11 · Updated · Mar 19, 2023 · C · Sponsor · Star 15 · // clone this repo with --depth=1 to save disk size // toolchain compatible with Ubuntu 20.04+ // android linux toolchain arm llvm gcc lto linux-kernel clang apple-clang aarch64 lld pgo arm-linux-gnueabi aarch64-linux-gnu clang-14 arm-li clang-15 apple-llvm ·
🌐
Jensd's I/O buffer
jensd.be › 1126 › linux › cross-compiling-for-arm-or-aarch64-on-debian-or-ubuntu
Cross compiling for arm or aarch64 on Debian or Ubuntu | Jensd's I/O buffer
January 26, 2021 - jensd@deb10:~$ sudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu Reading package lists... Done ... Processing triggers for man-db (2.8.5-2) ...
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! :)