Recent

Author Topic: [SOLVED] How to determine the required CPU-family for the FPC cross-compiler?  (Read 946 times)

Hartmut

  • Hero Member
  • *****
  • Posts: 749
I wrote a small "Hello world" program which runs on my linux computer with Intel CPU, but on a Linux server of a friend it shows this error message:

root@HelmiNAS:/opt# ./test32
-ash: ./test32: cannot execute binary file: Exec format error
root@HelmiNAS:/opt# ./test64
-ash: ./test64: cannot execute binary file: Exec format error


(I compiled the program both as 32- and 64-bit because we are unsure which would be right).

Can it be that we use the wrong CPU-family?
The friend assumes that he has an ARM-CPU, but "uname -a" shows "aarch64":

root@HelmiNAS:/opt# uname -a
Linux HelmiNAS 4.4.180+ #42962 SMP Sat Apr 8 00:12:20 CST 2023 aarch64 GNU/Linux rtd1296

With which linux command can we find out, which is definitely the correct CPU-family to install the correct cross-compiler (arm or aarch64) and whether we need to compile as 64-bit or 32-bit? We are both beginners on Linux.

Thanks in advance.
« Last Edit: April 29, 2023, 07:01:36 pm by Hartmut »

wildfire

  • Full Member
  • ***
  • Posts: 109
Can it be that we use the wrong CPU-family?
Yes
Quote
The friend assumes that he has an ARM-CPU, but "uname -a" shows "aarch64":

aarch64 is ARM not Intel
A halo is a mere circle, when does it end?

Hartmut

  • Hero Member
  • *****
  • Posts: 749
Thank you wildfire. But which cross-compiler do we have to install (arm or aarch64)? How can we determine this?

wildfire

  • Full Member
  • ***
  • Posts: 109
That's a tricky one, I myself am new to ARM & Linux

It's likely to be AARCH64 but not definite.

My Raspberry Pi is setup with a 64bit Kernel (AARCH64) but 32 bit userland, so it could be either or.

What hardware and OS is your friend using?
« Last Edit: April 29, 2023, 12:18:26 pm by wildfire »
A halo is a mere circle, when does it end?

Hartmut

  • Hero Member
  • *****
  • Posts: 749
What hardware and OS is your friend using?

The friend does not know much about this for sure. With which linux commands can we find this out?

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
The friend does not know much about this for sure. With which linux commands can we find this out?

uname, and /proc/cpuinfo for the gory details.

Also remember that you can inspect an executable file using the    file    command, but beyond that there is no good way of finding out the target processor of an arbitrary executable (i.e. the precise vector extensions it's been compiled for etc.).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Hartmut

  • Hero Member
  • *****
  • Posts: 749
What hardware and OS is your friend using?

The friend does not know much about this for sure. With which linux commands can we find this out?

uname, and /proc/cpuinfo for the gory details.

Also remember that you can inspect an executable file using the    file    command...

Thanks to wildfire and MarkMLl. Here come the results:

Code: Text  [Select][+][-]
  1. root@HelmiNAS:/opt# uname -a
  2. Linux HelmiNAS 4.4.180+ #42962 SMP Sat Apr 8 00:12:20 CST 2023 aarch64 GNU/Linux rtd1296
  3.  
Code: Text  [Select][+][-]
  1. root@HelmiNAS:~# cat /proc/cpuinfo
  2. processor       : 0
  3. model name      : ARMv8 Processor rev 4 (v8l)
  4. BogoMIPS        : 54.00
  5. Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
  6. CPU implementer : 0x41
  7. CPU architecture: 8
  8. CPU variant     : 0x0
  9. CPU part        : 0xd03
  10. CPU revision    : 4
  11.  
  12. processor       : 1
  13. model name      : ARMv8 Processor rev 4 (v8l)
  14. BogoMIPS        : 54.00
  15. Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
  16. CPU implementer : 0x41
  17. CPU architecture: 8
  18. CPU variant     : 0x0
  19. CPU part        : 0xd03
  20. CPU revision    : 4
  21.  
  22. processor       : 2
  23. model name      : ARMv8 Processor rev 4 (v8l)
  24. BogoMIPS        : 54.00
  25. Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
  26. CPU implementer : 0x41
  27. CPU architecture: 8
  28. CPU variant     : 0x0
  29. CPU part        : 0xd03
  30. CPU revision    : 4
  31.  
  32. processor       : 3
  33. model name      : ARMv8 Processor rev 4 (v8l)
  34. BogoMIPS        : 54.00
  35. Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32
  36. CPU implementer : 0x41
  37. CPU architecture: 8
  38. CPU variant     : 0x0
  39. CPU part        : 0xd03
  40. CPU revision    : 4

Code: Text  [Select][+][-]
  1. root@HelmiNAS:~# file /var/packages/synocli-file/target/bin/mc
  2. /var/packages/synocli-file/target/bin/mc: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, stripped
  3.  
  4. root@HelmiNAS:~# file /usr/bin/ls
  5. /usr/bin/ls: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, stripped
  6. root@HelmiNAS:~#

Above 'mc' is a MidnightCommander which runs on this linux server.

So again our question: which FPC cross-compiler do we have to install (arm or aarch64) to compile for this server? Above both is contained... (as said, we are beginners to that stuff)

wildfire

  • Full Member
  • ***
  • Posts: 109
Aarch64

Think of it as similar to x86 and amd64

You're using a 64bit Arm processor running in aarch64 mode.
« Last Edit: April 29, 2023, 06:16:09 pm by wildfire »
A halo is a mere circle, when does it end?

Hartmut

  • Hero Member
  • *****
  • Posts: 749
You're using a 64bit Arm processor running in aarch64 mode.

Thank you very much wildfire for your answer.

 

TinyPortal © 2005-2018