I compile a simple Hello World programm with different compilers (from https://github.com/raspberrypi/tools):
./arm-linux-gnueabihf-c++ ~/Desktop/hello.c -o ~/Desktop/myapp -static
The compilation succeeds and furthermore my image looks good:
$ file myapp myapp: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 2.6.26, BuildID[sha1]=3ad3c7c73f773688a654c2107a1d1409c07d0d9a, not stripped
Still I can't run the image:
$ ./myapp -bash: ./myapp: cannot execute binary file: Exec format error
$ uname -a Linux alarm 5.4.2-1-ARCH #1 SMP Fri Dec 6 02:43:30 UTC 2019 aarch64 GNU/Linux
I appreciate any help. If more information about my system is needed, let me know, but according to all of the tutorials I read through the procedure seemed quite easy for me. Turned out to be wrong. I also tried different compiler options resp. compilation with CMake. However, none of my methods eventually worked.