I am working on an assembly-based Forth (on top of Linux - https://github.com/mcmenaminadrian/riscyforth) for Risc-V and I can build it and run it on my real 64 bit hardware (a Nezha SBC running a Debian-based install).
I decided to test it also on QEMU with Fedora but it won't run:
[root@fedora-riscv riscyforth]# ./riscyforth
-bash: ./riscyforth: No such file or directory
This seems to be because I am missing a library:
readelf -a ./riscyforth
....
Program Headers:
Type Offset VirtAddr PhysAddr
FileSiz MemSiz Flags Align
PHDR 0x0000000000000040 0x0000000000010040 0x0000000000010040
0x0000000000000150 0x0000000000000150 R 0x8
INTERP 0x0000000000000190 0x0000000000010190 0x0000000000010190
0x000000000000000d 0x000000000000000d R 0x1
[Requesting program interpreter: /lib/ld.so.1]
And my understanding this is a 32 bit library - but my OS is 64 bit:
[root@fedora-riscv riscyforth]# uname -a
Linux fedora-riscv 5.10.6-200.0.riscv64.fc33.riscv64 #1 SMP Tue Jan 12 13:46:56 UTC 2021
riscv64 riscv64 riscv64 GNU/Linux
And, rather more importantly, so is the ELF:
[root@fedora-riscv riscyforth]# readelf -a ./riscyforth | more
ELF Header:
Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: RISC-V
Version: 0x1
Entry point address: 0x10690
Start of program headers: 64 (bytes into file)
Start of section headers: 98992 (bytes into file)
Flags: 0x5, RVC, double-float ABI
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 6
Size of section headers: 64 (bytes)
Number of section headers: 23
Section header string table index: 22
I have updated the Fedora install and rebooted (as there was a mix of -33 and -32 packages before) but this has not fixed the issue.
Why do I need to install a 32 library and which one do I need to install? I cannot find an obviously titled RPM.
Or do I need to put something in the Makefile for Fedora that I don't need on the Debian system?