Hi,

I don't have a completely good answer but per my observations it builds:
  1. Adding an external toolchain in $PATH e.g. arm-gnu-toolchain-13.2.rel1-aarch64-aarch64-none-elf from  https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads 
  2. if you don't have a toolchain in $PATH and provide it by CROSS_COMPILE e.g. make CROSS_COMPILE=<path>/arm-gnu-toolchain-12.2.rel1-aarch64-aarch64-none-elf/bin/aarch64-none-elf- PLAT=rpi5 DEBUG=1
  3. if you pass the native compiler path through CROSS_COMPILE e.g. make CROSS_COMPILE=/usr/bin/ PLAT=rpi5 DEBUG=1 

Regards,
Olivier.


From: Anand Moon via TF-A <tf-a@lists.trustedfirmware.org>
Sent: 04 July 2024 06:22
To: tf-a@lists.trustedfirmware.org <tf-a@lists.trustedfirmware.org>
Subject: [TF-A] Native compilation failed on dev board not able to find the gcc
 
Hi All,

I am trying to compile the latest ATF on Raspberry Pi 5 but it fails.
This is the same for all the other Arm64 architecture I have.
Earlier versions of ATF were able to compile on-board with native gcc.

Well with CROSS_COMPILE it works fine on x86_64 machine.

alarm@raspberrypi:~/Downloads/trusted-firmware-a$ make PLAT=rpi5 DEBUG=1
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The configured AArch64 C compiler could
not be identified and may not be supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The default AArch64 C compiler is:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The following tools are supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:   - ArmŽ Compiler for Embedded `armclang`
make_helpers/toolchain.mk:344:   - LLVM Clang (`clang`)
make_helpers/toolchain.mk:344:   - GNU GCC (`gcc`)
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The build system will treat this C
compiler as GNU GCC (`gcc`).
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The configured AArch64 C preprocessor
could not be identified and may not be supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The default AArch64 C preprocessor is:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The following tools are supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:   - ArmŽ Compiler for Embedded `armclang`
make_helpers/toolchain.mk:344:   - LLVM Clang (`clang`)
make_helpers/toolchain.mk:344:   - GNU GCC (`gcc`)
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The build system will treat this C
preprocessor as GNU GCC (`gcc`).
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The configured AArch64 assembler could
not be identified and may not be supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The default AArch64 assembler is:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The following tools are supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:   - ArmŽ Compiler for Embedded `armclang`
make_helpers/toolchain.mk:344:   - LLVM Clang (`clang`)
make_helpers/toolchain.mk:344:   - GNU GCC (`gcc`)
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The build system will treat this
assembler as GNU GCC (`gcc`).
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The configured AArch64 linker could not
be identified and may not be supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The default AArch64 linker is:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The following tools are supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:   - ArmŽ Compiler for Embedded `armclang`
make_helpers/toolchain.mk:344:   - ArmŽ Compiler for Embedded `armlink`
make_helpers/toolchain.mk:344:   - LLVM Clang (`clang`)
make_helpers/toolchain.mk:344:   - LLVM LLD (`lld`)
make_helpers/toolchain.mk:344:   - GNU GCC (`gcc`)
make_helpers/toolchain.mk:344:   - GNU LD (`ld.bfd`)
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The build system will treat this linker
as GNU GCC (`gcc`).
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The configured AArch64 object copier
could not be identified and may not be supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-objcopy
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The default AArch64 object copier is:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-objcopy
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The following tools are supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:   - ArmŽ Compiler for Embedded `fromelf`
make_helpers/toolchain.mk:344:   - LLVM `llvm-objcopy`
make_helpers/toolchain.mk:344:   - GNU `objcopy`
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The build system will treat this object
copier as GNU `objcopy`.
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The configured AArch64 object dumper
could not be identified and may not be supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-objdump
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The default AArch64 object dumper is:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-objdump
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The following tools are supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:   - ArmŽ Compiler for Embedded `fromelf`
make_helpers/toolchain.mk:344:   - LLVM `llvm-objdump`
make_helpers/toolchain.mk:344:   - GNU `objdump`
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The build system will treat this object
dumper as GNU `objdump`.
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The configured AArch64 archiver could
not be identified and may not be supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc-ar
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The default AArch64 archiver is:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:     aarch64-none-elf-gcc-ar
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The following tools are supported:
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344:   - ArmŽ Compiler for Embedded `armar`
make_helpers/toolchain.mk:344:   - LLVM `llvm-ar`
make_helpers/toolchain.mk:344:   - GNU `ar`
make_helpers/toolchain.mk:344:
make_helpers/toolchain.mk:344: The build system will treat this
archiver as GNU `ar`.
make_helpers/toolchain.mk:344:
/bin/sh: 1: aarch64-none-elf-gcc: not found
/bin/sh: 1: aarch64-none-elf-gcc: not found
  CC      bl31/bl31_context_mgmt.c
make: aarch64-none-elf-gcc: No such file or directory
make: *** [Makefile:1514:
/home/alarm/Downloads/trusted-firmware-a/build/rpi5/debug/bl31/bl31_context_mgmt.o]
Error 127
alarm@raspberrypi:~/Downloads/trusted-firmware-a$

alarm@raspberrypi:~/Downloads/trusted-firmware-a$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/12/lto-wrapper
Target: aarch64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian
12.2.0-14' --with-bugurl=file:///usr/share/doc/gcc-12/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2
--prefix=/usr --with-gcc-major-version-only --program-suffix=-12
--program-prefix=aarch64-linux-gnu- --enable-shared
--enable-linker-build-id --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --libdir=/usr/lib
--enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-libquadmath
--disable-libquadmath-support --enable-plugin --enable-default-pie
--with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto
--enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror
--enable-checking=release --build=aarch64-linux-gnu
--host=aarch64-linux-gnu --target=aarch64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (Debian 12.2.0-14)

Thanks
-Anand
--
TF-A mailing list -- tf-a@lists.trustedfirmware.org
To unsubscribe send an email to tf-a-leave@lists.trustedfirmware.org