1. Download the source code for the gcc compiler from the official website. You can download the latest version from here: https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz

wget https://ftp.gnu.org/gnu/gcc/gcc-11.2.0/gcc-11.2.0.tar.xz

  1. Extract the source code:

    tar xf gcc-11.2.0.tar.xz

  2. Change to the directory where the source code was extracted:

    cd gcc-11.2.0

  3. Configure the build:

    ./configure --target=aarch64-linux-gnu --prefix=/usr/local

  4. Build and install the compiler:

    make -j4 && sudo make install This will build and install the aarch64-linux-gnu-gcc compiler into the /usr/local/bin directory.

  5. Verify that aarch64-linux-gnu-gcc is installed:

    aarch64-linux-gnu-gcc --version This should display the version of aarch64-linux-gnu-gcc that is installed on your system.

Answer from mouwahed on Stack Overflow
🌐
Arm Developer
developer.arm.com › downloads › - › gnu-a
Downloads | GNU-A Downloads – Arm Developer
Download the The GNU Toolchain for the Cortex-A Family are integrated and validated packages featuring the GCC compiler, libraries and other GNU tools necessary for software development on devices based on the Arm Cortex-A processors or the Arm A-profile architecture.
🌐
Arm Developer
developer.arm.com › downloads › - › arm-gnu-toolchain-downloads
Arm GNU Toolchain Downloads – Arm Developer
For Linux, the binaries are provided as tarball files. For macOS, the binaries are provided as tarball files and pkg files. The sources for this release are provided in the source tar ball, arm-gnu-toolchain-src-snapshot-15.2.rel1.tar.xz, and includes the following items: ... $ md5sum --check arm-gnu-toolchain-15.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz.asc arm-gnu-toolchain-15.2.rel1-x86_64-aarch64-none-linux-gnu.tar.xz: OK
🌐
GitHub
github.com › najahiiii › aarch64-linux-gnu
GitHub - najahiiii/aarch64-linux-gnu: GNU GCC Toolchain
LINARO (GCC) ARM64 · 8.3.0 · LINARO 8.3.0 - 20190402 · git clone https://github.com/najahiiii/aarch64-linux-gnu.git -b linaro8-20190402 · Fine · Date · Variant · Arch · Version · Repo Link · Clone · Status · 01/03/2019 · GNU (GCC) ARM64 · 4.9.4 · GCC 4.9.4 - 20190301 ·
Starred by 11 users
Forked by 12 users
🌐
Texas Instruments
software-dl.ti.com › jacinto7 › esd › processor-sdk-linux-jacinto7 › latest › exports › docs › linux › Overview › GCC_ToolChain.html
1.1.5. GCC ToolChain Setup — Processor SDK Linux for J721e Documentation
host# COMPILER_PATH=/opt/arm-toolchain host# mkdir -p $COMPILER_PATH host# wget -c https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz -O - | tar -xv -J -C $COMPILER_PATH host# wget -c https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz -O - | tar -xv -J -C $COMPILER_PATH host# export CROSS_COMPILE_64=$COMPILER_PATH/arm-gnu-toolchain-13.3.rel1-x86_64-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu- host# export CROSS_COMPILE_32=$COMPILER_PATH/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf- host# export CC_64="${CROSS_COMPILE_64}gcc" host# export CC_32="${CROSS_COMPILE_32}gcc"
🌐
Arch Linux
archlinux.org › packages › extra › x86_64 › aarch64-linux-gnu-gcc
Arch Linux - aarch64-linux-gnu-gcc 15.2.0-1 (x86_64)
Download From Mirror · aarch64-linux-gnu-binutils · aarch64-linux-gnu-glibc · libisl · libmpc · zlib · zstd · gmp (make) mpfr (make) aarch64-linux-gnu-glibc · rust-aarch64-gnu · rust-aarch64-musl · rustup (optional) edk2 (make) efifs (make) lib32-rust-libs (make) musl (make) rust (make) View the file list for aarch64-linux-gnu-gcc ·
🌐
Pkgs.org
pkgs.org › download › gcc-aarch64-linux-gnu
Gcc-aarch64-linux-gnu Download (DEB, RPM)
Download gcc-aarch64-linux-gnu packages for ALT Linux, CentOS, Debian, Fedora, Mageia, Ubuntu
🌐
Debian
packages.debian.org › sid › gcc-aarch64-linux-gnu
Debian -- Details of package gcc-aarch64-linux-gnu in sid
dep: gcc-15-aarch64-linux-gnu (>= 15.2.0-2~) GNU C compiler for the aarch64-linux-gnu architecture · rec: libc-dev [arm64] Package not available · rec: libc6-dev [arm64] GNU C Library: Development Libraries and Header Files also a virtual package provided by libc6.1-dev ·
🌐
Linux Man Pages
linux.die.net › man › 1 › aarch64-linux-gnu-gcc
aarch64-linux-gnu-gcc(1) - Linux man page
GCC is capable of preprocessing and compiling several files either into several assembler input files, or into one assembler input file; then each assembler input file produces an object file, and linking combines all the object files (those newly compiled, and those specified as input) into ...
Find elsewhere
🌐
Debian
packages.debian.org › stretch › gcc-aarch64-linux-gnu
Client Challenge
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Texas Instruments E2E
e2e.ti.com › support › processors-group › processors › f › processors-forum › 925224 › compiler-am6548-where-can-i-find-the-aarch64-none-linux-gnu-gcc-toolchain-to-download
Compiler/AM6548: Where can I find the aarch64-none-linux-gnu-gcc toolchain to download - Processors forum - Processors - TI E2E support forums
Toolchain SDK 6.0 : aarch64-linux-gnu-gcc Toolchain SDK 7.0 : aarch64-none-linux-gnu-gcc · On TI SDK Download page for SDK 7.0 Independent toolchain is still old gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz (aarch64-linux-gnu-gcc), From where can I download independent toolchain for aarch64-none-linux-gnu-
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.

🌐
Juszkiewicz
marcin.juszkiewicz.com.pl › 2020 › 09 › 23 › 8-years-of-my-work-on-aarch64
8 years of my work on AArch64 – Marcin Juszkiewicz
September 23, 2020 - Some time later first non-public patches for binutils and gcc arrived in my inbox. Then eglibc ones. So I started building and on 12th September 2012 I was able to build helloworld: 12:38 hrw@puchatek:aarch64-oe-linux$ ./aarch64-oe-linux-gcc ~/devel/sources/hello.c -o hello 12:38 ...
🌐
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.
🌐
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
These Builds (on master/main branch) are always made from the latest GCC sources rather than stable releases. This toolchain AArch64 AArch32 here. Built with Support for Link Time Optimization, -O3, --disable-nls and removed extras that we don't need. Clone using git from this repo, As 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%
🌐
Arch Linux Man Pages
man.archlinux.org › man › aarch64-linux-gnu-gcc.1.en
aarch64-linux-gnu-gcc(1) — Arch manual pages
March 18, 2020 - gcc - GNU project C and C++ compiler · gcc [-c|-S|-E] [-std=standard] [-g] [-pg] [-Olevel] [-Wwarn...] [-Wpedantic] [-Idir...] [-Ldir...] [-Dmacro[=defn]...] [-Umacro] [-foption...] [-mmachine-option...] [-o outfile] [@file] infile