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
🌐
Duetorun
duetorun.com › blog › 20230401 › arm-toolchain
Arm GNU Toolchain - ElseWhere
As the well-known shims or wrappers like cpp,gcc,g++,cc,c++, has been taken over by previously installed aarch64-linux-gnu-gcc, you should always explicitly specify the prefix arm-linux-gnueabihf- when using them.
🌐
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". https://gcc.gnu.org/install/specific.html · Little-endian is the default bit ordering on ARM. Toolchains for little-endian, 64-bitARMv8for GNU/Linux systems · gcc-linaro-*x86_64_aarch64-linux-gnu.tar.xz ·
🌐
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 - How to install aarch64-linux-gnu and arm-linux-gnueabihf in cygwin for cross compilation#661 · Copy link · Labels · Help wanted · BhaskarsarmaP · opened · on Mar 31, 2019 · Issue body actions · Need process of installing cross compiler in cygwin. I have installed scons and need the process of installing cross compiler for arm .
Author   BhaskarsarmaP
🌐
Arm Learning
learn.arm.com › install-guides › gcc › cross
Cross-compiler | Arm Learning Paths
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 - As you see, I built this one for use on aarch64. If you want to do the same for armv6 or armv7, simply replace –host aarch64-linux-gnu with –host arm-linux-gnueabi when running configure.
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.

Find elsewhere
🌐
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.
🌐
Debian
wiki.debian.org › Multiarch › Tuples
Multiarch Architecture Specifiers (Tuples)
For example, Debian armhf targets ARMv7 with VFPv3-D16 CPUs, but Raspbian (the basis for Raspberry Pi armhf) targets ARMv6 with VFPv2 CPUs, such as the Raspberry Pi 1, leading to strange run-time errors when running packages with the wrong definition of arm-linux-gnueabihf. Earlier proposals used GNU triplets as the components of the library path.
🌐
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
🌐
Raspberry Pi Forums
forums.raspberrypi.com › board index › using the raspberry pi › beginners
SOLVED: What is arm-linux-gnueabihf? - Raspberry Pi Forums
Sun Nov 21, 2021 1:17 am Is it safe to delete? No. You'll break your install if you delete /usr/lib/arm-linux-gnueabihf. Software libraries are kept in there.
🌐
Launchpad
answers.launchpad.net › gcc-arm-embedded › +question › 668741
Question #668741 “Difference between arm-linux-gnueabi-gcc and a...” : Questions : GNU Arm Embedded Toolchain
Hi, I'm new with arm compiler tool chains. I discovered that ubuntu got two different arm toolchains: gcc-arm-embedded (from Debian and your ppa) and gcc-arm-linux-gnueabi (directly maintained by canonical). I also discovered that gcc-arm-embedded latest version refers to gcc version 7, but ...
🌐
Linaro
linaro.org › downloads
Downloads | Linaro
GNU Toolchain plays an essential role in the development of Linux. Created by the GNU Project, it is a group of programming tools used for developing software applications and operating systems. The official Arm releases of the pre-built GNU cross-toolchain for AArch64 and ARM 32-bit A-Profile cores are available on the Arm Developer website.
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

🌐
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"
🌐
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