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
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
Maybe aarch64-linux-gnu-gcc is not installed. More on stackoverflow.com
🌐 stackoverflow.com
Using cross-compilation for ARM64 in the Ubuntu 24.04 x86 environment
I would like to ask if my setup is correct. Why does the file not change to ARM64 after running cmake --install . ? sudo apt-get install gcc-aarch64-linux-gn... More on forum.qt.io
🌐 forum.qt.io
4
0
March 10, 2025
arm64 - How to install aarch64-linux-gnu-gcc on OpenSUSE 15.4 - Stack Overflow
I want to install aarch64-linux-gnu-gcc on an OpenSUSE 15.4 system. What is the command to install this? I try zypper install cross-aarch64-gcc7 but the package doesn't exist. More on stackoverflow.com
🌐 stackoverflow.com
Cannot compile project in Aarch64 in Arch Linux
Well the `openssl` library of your system will not do you any good if cross compile. Most libraries which use openssl have an option to bundle/vendor the library which means it is cross compiled as well. You should do that. Or switch to rust-tls. I assume this is the issue, but without the error output this is shot in the dark. The `cargo.toml` in itself would be helpful aswell. More on reddit.com
🌐 r/rust
8
2
July 25, 2024
🌐
Arch Linux
archlinux.org › packages › extra › x86_64 › aarch64-linux-gnu-gcc
Arch Linux - aarch64-linux-gnu-gcc 16.1.0-1 (x86_64)
View the file list for aarch64-linux-gnu-gcc · View the soname list for aarch64-linux-gnu-gcc
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).

🌐
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)
🌐
Pkgs.org
pkgs.org › download › gcc-aarch64-linux-gnu
Gcc-aarch64-linux-gnu Download (DEB, RPM)
Download gcc-aarch64-linux-gnu linux packages for ALT Linux, CentOS, Debian, Fedora, Mageia, Ubuntu
Find elsewhere
🌐
Linux Man Pages
linux.die.net › man › 1 › aarch64-linux-gnu-gcc
aarch64-linux-gnu-gcc(1) - Linux man page
GNU dialect of -std=c++11. Support for C ++ 11 is still experimental, and may change in incompatible ways in future releases. ... The option -fgnu89-inline tells GCC to use the traditional GNU semantics for "inline" functions when in C99 mode. This option is accepted and ignored by GCC versions 4.1.3 up to but not including 4.3.
🌐
Ubuntu Packages
ubuntu.pkgs.org › 18.04 › ubuntu-main-amd64 › gcc-aarch64-linux-gnu_7.3.0-3ubuntu2_amd64.deb.html
gcc-aarch64-linux-gnu_7.3.0-3ubuntu2_amd64.deb Ubuntu 18.04 LTS Download
gcc-aarch64-linux-gnu - GNU C compiler ... Update the package index: # sudo apt-get update · Install gcc-aarch64-linux-gnu deb package: # sudo apt-get install gcc-aarch64-linux-gnu...
🌐
Fedora
packages.fedoraproject.org › pkgs › cross-gcc › gcc-aarch64-linux-gnu
gcc-aarch64-linux-gnu - Fedora Packages
Cross-build binary utilities for aarch64-linux-gnu ... Cross-build GNU C compiler. Only building kernels is currently supported. Support for cross-building user space programs is not currently provided as that would massively multiply the number of packages. ... License(s): GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl
🌐
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 ·
🌐
GitHub
github.com › dopaemon › aarch64-linux-gnu
GitHub - dopaemon/aarch64-linux-gnu: GCC arm64
sudo dnf groupinstall "Development tools" sudo dnf install mpfr-devel gmp-devel libmpc-devel zlib-devel glibc-devel.i686 glibc-devel binutils-devel g++ texinfo bison flex cmake which clang ninja-build lld bzip2 · Running this script is quite simple. We start by cloning this repository: git clone https://github.com/mvaisakh/gcc-build.git gcc-build
Author   dopaemon
🌐
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
🌐
LinuxVox
linuxvox.com › blog › aarch64linuxgnugcc
A Comprehensive Guide to aarch64-linux-gnu-gcc — linuxvox.com
It provides essential functions ... to use the AArch64 version of glibc on the target system. sudo apt-get update sudo apt-get install g++-aarch64-linux-gnu...
🌐
Arm Developer
developer.arm.com › downloads › - › gnu-a
Downloads | GNU-A Downloads – Arm Developer
Download the toolchain manifest file from the GNU Arm toolchain page on developer.arm.com, for example: gcc-arm-aarch64-none-elf-abe-manifest.txt. ... The built toolchain will be installed and available for use in the builds/destdir/x86_64-unknown-linux-gnu/bin/ directory.
🌐
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 10, 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 ...
🌐
Stack Overflow
stackoverflow.com › questions › 76270884 › how-to-install-aarch64-linux-gnu-gcc-on-opensuse-15-4
arm64 - How to install aarch64-linux-gnu-gcc on OpenSUSE 15.4 - Stack Overflow
zypper addrepo https://download.opensuse.org/repositories/openSUSE:Factory/standard/openSUSE:Factory.repo zypper refresh zypper install cross-aarch64-gcc7 · This should add the Factory repository and install cross aarch64.
🌐
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.
🌐
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%