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
The package names of the released GNU toolchain binaries have the following naming convention: gcc-arm-<Release Version>-<Host>-<Target Triple>.tar.xz · Extract XZ compressed release archive using TAR archiving utility: $ tar -xJf <toolchain binary> -C <destination directory> Example for Linux(x86_64) hosted for AArch64 Linux target · $ tar -xJf gcc-arm-10.2-2020.11...
🌐
Launchpad
code.launchpad.net › ubuntu › oracular › +package › gcc-11-aarch64-linux-gnu
gcc-11-aarch64-linux-gnu : Oracular (24.10) : Ubuntu
gcc-11-aarch64-linux-gnu · This is the GNU C compiler, a fairly portable optimizing compiler for C. . This package contains C cross-compiler for arm64 architecture. gcc-11-cross 21ubuntu4 source package in Ubuntu ·
🌐
Debian
packages.debian.org › sid › gcc-11-aarch64-linux-gnu
Debian -- Details of package gcc-11-aarch64-linux-gnu in sid
dep: cpp-11-aarch64-linux-gnu (= 11.5.0-2cross1) GNU C preprocessor · dep: gcc-11-aarch64-linux-gnu-base (= 11.5.0-2cross1) GCC, the GNU Compiler Collection (base package) dep: libc6 (>= 2.38) GNU C Library: Shared libraries also a virtual package provided by libc6-udeb ·
🌐
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-14.3.rel1.tar.xz, and includes the following items: ... $ md5sum --check arm-gnu-toolchain-14.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz.asc arm-gnu-toolchain-14.3.rel1-x86_64-aarch64-none-linux-gnu.tar.xz: OK
🌐
Vanillaos
packages.vanillaos.org › package › gcc-11-aarch64-linux-gnu
gcc-11-aarch64-linux-gnu
pool/main/g/gcc-11-cross/gcc-11-aarch64-linux-gnu_11.5.0-7cross1_amd64.deb ·
🌐
Ubuntu
launchpad.net › ubuntu › jammy › +package › gcc-11-aarch64-linux-gnu
gcc-11-aarch64-linux-gnu : Jammy (22.04) : Ubuntu
gcc-11-aarch64-linux-gnu · This is the GNU C compiler, a fairly portable optimizing compiler for C. . This package contains C cross-compiler for arm64 architecture. gcc-11-cross 11ubuntu1.3 source package in Ubuntu ·
🌐
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.
Find elsewhere
🌐
Arch Linux
archlinux.org › packages › extra › x86_64 › aarch64-linux-gnu-gcc
Arch Linux - aarch64-linux-gnu-gcc 15.2.0-1 (x86_64)
View the file list for aarch64-linux-gnu-gcc · View the soname list for aarch64-linux-gnu-gcc
🌐
Debian
packages.debian.org › sid › gcc-aarch64-linux-gnu
Debian -- Details of package gcc-aarch64-linux-gnu in sid
gcc-mipsel-linux-gnu · 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. dep: cpp-aarch64-linux-gnu (= 4:15.2.0-5) GNU C preprocessor (cpp) for the arm64 architecture ·
🌐
Pkgs.org
pkgs.org › download › gcc-aarch64-linux-gnu
Gcc-aarch64-linux-gnu Download (DEB, RPM)
gcc-aarch64-linux-gnu latest versions: 12.1.1, 11.2.1, 11.2.0, 10.3.1, 10.2.1, 9.3.0, 8.3.0, 8.2.1, 7.4.0, 7.3.0, 4.8.5, 4.8.1
🌐
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
Bleeding edge GNU GCC toolchain (CC only) built from sources using latest binutils and glibc - radcolor/aarch64-linux-gnu
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%
🌐
GNU
gcc.gnu.org › onlinedocs › gcc › AArch64-Options.html
AArch64 Options (Using the GNU Compiler Collection (GCC))
The value ‘native’ is available on native AArch64 GNU/Linux and causes the compiler to pick the architecture of the host system. This option has no effect if the compiler is unable to recognize the architecture of the host system. When -march=native is given and no other -mcpu or -mtune is given then GCC ...
🌐
GitHub
github.com › topics › aarch64-linux-gnu
aarch64-linux-gnu · GitHub Topics · GitHub
c assembly x86-64 efficiency msvc aarch64 mingw-w64 256bit riscv-asm riscv64 aarch64-linux-gnu bignum-library ... This repo contains Weekly GCC 11 builds for x86_64 hosts, targeted for bare-metal (ELF / kernel-only) AArch64 systems.
🌐
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 › bullseye › devel › gcc-9-aarch64-linux-gnu
Debian -- Details of package gcc-9-aarch64-linux-gnu in bullseye
/ Packages / bullseye (oldoldstable) / devel / gcc-9-aarch64-linux-gnu · [ bullseye ] [ Source: gcc-9-cross ] Bug Reports · Developer Information · Debian Changelog · Copyright File · [gcc-9-cross_25.dsc] [gcc-9-cross_25.tar.xz] Debian GCC Maintainers (QA Page, Mail Archive) Matthias Klose (QA Page) Homepage [gcc.gnu.org] gcc-11-aarch64-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.

🌐
Installati.one
installati.one › home › how to install gcc-11-aarch64-linux-gnu on ubuntu 22.04
How To Install gcc-11-aarch64-linux-gnu on Ubuntu 22.04 | Installati.one
June 27, 2023 - In this tutorial we learn how to install gcc-11-aarch64-linux-gnu on Ubuntu 22.04. gcc-11-aarch64-linux-gnu is GNU C compiler (cross compiler for arm64 architecture)