The answer is no.

The tool chain you are referencing is old, and works for 32bit architectures.

You need this (ubuntu): sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

Answer from CraigDavid on Stack Overflow
🌐
Gitbook
cswang.gitbook.io › soc › chapter1
ARM and AArch64 Target Triples | SoC
April 12, 2020 - For example the Linux OS and the GNU hardfloat ABI might have the following <_operatingsystem>, "-linux-gnueabihf". Whereas a bare-metal target will not have an OS but only the embedded ABI, "-eabi". ... Little-endian is the default bit ordering on ARM. Toolchains for little-endian, 64-bitARMv8for GNU/Linux systems ... gcc-linaro-*i686-mingw32_aarch64-linux-gnu.tar.xz Windows 32-bit binaries for the Aarch64 Linux cross-toolchain
🌐
GitHub
github.com › ARM-software › ComputeLibrary › issues › 661
How to install aarch64-linux-gnu and arm-linux-gnueabihf in cygwin for cross compilation · Issue #661 · ARM-software/ComputeLibrary
March 31, 2019 - You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert · {{ message }} ARM-software / ComputeLibrary Public · Notifications · You must be signed in to change notification settings · Fork 807 · Star 3.1k · New issueCopy link · New issueCopy link · Closed · Closed · How to install aarch64-linux-gnu and arm-linux-gnueabihf in cygwin for cross compilation#661 ·
Author   BhaskarsarmaP
Discussions

Does gcc-arm-linux-gnueabi build for a 64 bit target? - Stack Overflow
The processor I'm building for is 64 bit ARM. Will this tool chain work? More on stackoverflow.com
🌐 stackoverflow.com
embedded - What is the difference between aarch64-none-elf and arm-none-eabi? - Stack Overflow
From what I undestand, aarch64-none-elf targets 64-bit ARMv8-A, while arm-none-eabi targets 32-bit ARMv7 and earlier, it cannot compile for aarch64, right?. Aarch64-none-elf uses ELF, while arm-non... More on stackoverflow.com
🌐 stackoverflow.com
c - How can I build ARMv8 aarch32 binary? - Stack Overflow
I'm using Mediatek X20 dev board and gcc-linaro-6.3.1-2017.05 version for benchmark aarch64 vs aarch32. So I want to build binaries as 2 types of aarch32 abi : lp64, ilp32. From gcc manual, (@ [ More on stackoverflow.com
🌐 stackoverflow.com
Cross-compilation from Arch Linux x86-64 to Raspberri Pi OS Armv8
Have you tried cross ? If your target is supported (it is in this case) it’s generally the easiest way to cross compile. More on reddit.com
🌐 r/rust
11
4
October 31, 2022
🌐
Duetorun
duetorun.com › blog › 20230401 › arm-toolchain
Arm GNU Toolchain - ElseWhere
The executables for 32-bit are arm-linux-gnueabihf-gcc and arm-linux-gnueabihf-g++. The executables for 64-bit are aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++.
🌐
Arm Developer
developer.arm.com › downloads › - › gnu-a
Downloads | GNU-A Downloads – Arm Developer
Toolchains dedicated for Windows host require mingw-w64 library, a complete runtime environment for GCC. 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-9.2-2019.12-x86_64-aarch64-linux-gnu.tar.xz -C /path/to/destination/directory
🌐
Linaro
linaro.org › downloads
Downloads | Linaro
The official community releases of the pre-built LLVM native toolchain for AArch64 and ARM 32-bit A-Profile cores are built and tested by Linaro and are now available on LLVM’s GitHub. In addition to the usual Linux-hosted LLVM toolchain, Linaro is now providing official LLVM Toolchain for Windows on Arm starting with LLVM 12.0.0 release.
Find elsewhere
Top answer
1 of 1
1

(I have the same confusion. And I try to answer it based on my investigation/understanding.)

Possible Naming Schema

According to quote from ARM GNU Toolchain Downloads page, bare metal and Linux are two different targets. And to differentiate from the target architecture, I call it target environment. And my way to tell it is: if it has "linux" in the name, it targets Linux environment, otherwise bare metal.

Available for bare-metal and Linux targets

So I interpret the toolchain names with below schema:

...<host_arch>-<target_arch>-<vendor>-<target_env+abi>
  1. Host OS: on what OS the toolchain itself runs. This is not part of the name but listed in the toolchain download page.

  2. Host Arch: on what machine architecture the toolchain itself runs.

  3. Target Arch: What machine architecture the toolchain's output targets.

  4. Vendor: Who offers the toolchain.

  5. Target Environment: can be bare metal or GNU/Linux.

  6. ABI: things like call conventions for assembly functions. This is related to both architecture and OS (link). So far I have seen: eabi/elf/linux-gnu/linux-gnueabi

About the "target_env+abi" part

I think this is the most confusing part. ABI is related to machine architecture, OS and language (link). And I think below naming convention holds based on the both the Target Arch + Target Environment.

  1. For AArch32 + bare metal, use "eabi".

  2. For AArch64 + bare metal, use "elf". (similar to eabi)

  3. For AArch32 + Linux/GNU, use "linux-gnueabi" (eabi generated by gcc)

  4. For AArch64 + Linux/GNU, use "linux-gnu" (maybe similar to 3 just like 2 to 1)

So I think all 4 of them are about EABI. But may have some subtle differences.

Hope some guru can shed some light here.

Examples

Let's take some toolchain names from the ARM GNU Toolchain Downloads page as examples.

Example 1:
arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi.zip

  1. Host Arch = x86-64 because of the "mingw-w64-i686"

  2. Host OS = Windows because listed so.

  3. Target Arch = AArch32 because of the arm.

  4. Target Environment = bare metal because no linux in the name.

  5. Vendor: by open-source community, no specific vendor so it is none.

  6. ABI = eabi

Example 2:
arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-linux-gnueabihf.zip

  1. Host Arch = x86-64 because of the "mingw-w64-i686"

  2. Host OS = Windows because listed so.

  3. Target Arch = AArch32 because of the arm.

  4. Target Environment = GNU Linux because of the "linux" in the name.

  5. Vendor: by open-source community, no specific vendor so it is none.

  6. ABI = linux-gnueabi

Example 3:
arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-aarch64-none-elf.zip

  1. Host Arch = x86-64 because of the "mingw-w64-i686"

  2. Host OS = Windows because listed so.

  3. Target Arch = AArch64 because of the "aarch64".

  4. Target Environment = bare metal because no linux in the name.

  5. Vendor: by open-source community, no specific vendor so it is none.

  6. ABI = elf

Example 4:
arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz

  1. Host Arch = x86-64 because of the "x86_64"

  2. Host OS = Linux because listed so.

  3. Target Arch = AArch32 because of the "arm".

  4. Target Environment = bare metal because no linux in the name.

  5. Vendor: by open-source community, no specific vendor so it is none.

  6. ABI = eabi

Example 5:
arm-gnu-toolchain-14.2.rel1-aarch64-aarch64-none-linux-gnu.tar.xz

  1. Host Arch = AArch64 because of the first "aarch64"

  2. Host OS = Linux because listed in Linux-hosted section

  3. Target Arch = AArch64 because of the second "aarch64".

  4. Target Environment = GNU Linux because of the "linux" in the name.

  5. Vendor: by open-source community, no specific vendor so it is none.

  6. ABI = linux-gnu

To answer the original question

  • aarch64-none-elf: is for AArch64 bare metal, vendor is none

  • arm-none-eabi: is for AArch32 bare metal, vendor is none

🌐
Arm Learning
learn.arm.com › install-guides › gcc › cross
Cross-compiler | Arm Learning Paths
For bare-metal and embedded targets such as arm-none-eabi, see the Arm GNU Toolchain install guide. GCC is used to cross-compile Linux applications targeting Arm. Applications can be compiled for 32-bit or 64-bit Arm Linux systems. The executables for 32-bit are arm-linux-gnueabihf-gcc and arm-linux-gnueabihf-g++. The executables for 64-bit are aarch64-linux-gnu-gcc and aarch64-linux-gnu-g++.
🌐
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 - But here we need to specify the build and host platform so that we want to end up with a binary (statically linked) for ARM: jensd@deb10:~/strace-5.10$ ./configure --build x86_64-pc-linux-gnu --host aarch64-linux-gnu LDFLAGS="-static -pthread" --enable-mpers=check checking for a BSD-compatible ...
🌐
NXP Community
community.nxp.com › t5 › i-MX-Processors › What-s-the-difference-between-arm-linux-arm-none-linux-gnueabi › td-p › 258887
Solved: What's the difference between arm-linux- / arm-none-linux-gnueabi- / arm-fsl-linux-gnueabi- in LTIB? - NXP Community
March 25, 2014 - arm-none-linux-gnueabi - This toolchain targets the ARM architecture, has no vendor, creates binaries that run on the Linux operating system, and uses the GNU EABI.
🌐
Arm Community
community.arm.com › support-forums › f › compilers-and-libraries-forum › 12062 › windows-version-of-arm-linux-gnueabi-and-arm-linux-gnueabihf-for-gcc8
Windows version of arm-linux-gnueabi and ...
Have a question about working on Arm technology? Browse our support forums for solutions to your questions, answer questions from fellow community members and get help from Arm experts.
🌐
Arm Developer
developer.arm.com › downloads › - › arm-gnu-toolchain-downloads
Arm GNU Toolchain Downloads – Arm Developer
aarch64_be-none-linux-gnu-gdb and aarch64_be-none-linux-gnu-gdb-py on Linux hosts requires liblzma.so.5. Toolchains dedicated for Windows host require mingw-w64 library, a complete runtime environment for GCC.
🌐
Acmesystems
acmesystems.it › arm9_toolchain
Install the ARM cross compiler toolchain on your Linux PC
This article illustrates how to install on a Linux PC the complete toolchain to cross compile the Linux Kernel, device drivers and applications for the Acme Systems Linux board · This procedure has been tested on Debian "Bookworm" 12
Top answer
1 of 4
74

Install gcc-arm-linux-gnueabi and binutils-arm-linux-gnueabi packages, and then just use arm-linux-gnueabi-gcc instead of gcc for compilation.

You need to be careful on what flavour of linux and binutils you have on your target system. The newest stuff is hardfloat, in this case you would do:

sudo apt-get install gcc-arm-linux-gnueabihf

This brings in the complete cross-compile environment, including binutils.

For using this GCC in the build process write:

CC=arm-linux-gnueabihf-gcc make
2 of 4
23

64-bit ARM

For 64-bit ARM, the toolchain prefix is aarch64 and usage is:

sudo apt install gcc-aarch64-linux-gnu
aarch64-linux-gnu-gcc -o main.out main.c

You can try it out on this C hello world with QEMU:

main.c

#include <stdio.h>

int main(void) {
    puts("hello");
}

and then:

sudo apt install qemu-user
qemu-aarch64 main.out

will output:

hello

Then a few fun things you can do to quickly see that ARM is actually running under the hood:

  • GDB step debug it: https://stackoverflow.com/questions/20590155/how-to-single-step-arm-assembly-in-gdb-on-qemu/51310791#51310791
  • log the executed ARM instructions with: qemu-aarch64 -d in_asm,out_asm main.out https://stackoverflow.com/questions/13005303/how-does-native-android-code-written-for-arm-run-on-x86/44505097#44505097

Tested in Ubuntu 19.10.

For reliability in serious applications, the disk image provider must also provide a compatible cross compiler

Although you can install a cross compiler with apt conveniently, I must warn you that this is not necessarily reliable unless explicitly supported by the image provider.

If you pick the cross compiler wrongly, the following may happen:

  • the dynamic linker is at the wrong path: https://stackoverflow.com/questions/31929092/trying-to-run-a-cross-compiled-executable-on-target-device-fails-with-no-such-f/49993116#49993116
  • binary incompatibility with the glibc and any other libraries you link against: https://stackoverflow.com/questions/11107263/how-compatible-are-different-versions-of-glibc

Raspberry PI cross compilation

For RPI in particular, the provided cross compilers are available at: https://github.com/raspberrypi/tools and can be used as explained at: https://raspberrypi.stackexchange.com/questions/64273/installing-raspberry-pi-cross-compiler/83215#83215

git clone https://github.com/raspberrypi/tools
export PATH="$(pwd)/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:${PATH}"
printf '#include <stdio.h>\nint main() { puts("hello world"); }\n' > hello_world.c
printf '#include <iostream>\nint main() { std::cout << "hello world" << std::endl; }\n' > hello_world.cpp
arm-linux-gnueabihf-gcc -std=c99 -o hello_world_c hello_world.c
arm-linux-gnueabihf-g++ -std=c++11 -o hello_world_cpp hello_world.cpp

Ubuntu cross compilation

If you want to cross compile for Ubuntu arm64, I have never been able to find a clear reference on which cross compilers support which distro version: What are the officially supported cross compilers for Ubuntu server alternative architectures like ARM?

Buildroot

My favorite alternative is to build your own image with Buildroot: https://stackoverflow.com/questions/47557262/how-to-download-the-torvalds-linux-kernel-master-recompile-it-and-boot-it-wi/49349237#49349237

This builds everything from source, including the toolchain and the image, and ensures that everything is compatible.

🌐
Debian
wiki.debian.org › Multiarch › Tuples
Multiarch Architecture Specifiers (Tuples)
On IA-32, the GNU triplet varies according to the precise instruction set being targeted: e.g., i486-linux-gnu, i586-linux-gnu i686-linux-gnu. Such triplets will be inconsistent over time within a single distribution as compiler defaults are changed, let alone between distributions. Historical note: On ARM, the canonical GNU triplet for EABI systems, whether using hard-float or soft-float, was arm-linux-gnueabi, despite the fact that hard-float and soft-float libraries use different calling conventions and can't be intermixed.
🌐
Programmersought
programmersought.com › article › 2030933178
The difference between arm-linux-gnueabihf, aarch64-linux-gnu and other ARM cross-compilation GCC - Programmer Sought
Upgrade the cross-compilation environment, arm-linux-gnueabihf-gcc is upgraded to 6, Your GCC is older than 6.0 and is not supported