Search code examples
qemuarm64gem5

cannot open /lib/ld-linux-aarch64.so.1 in qemu or gem5


I am trying to simulate a simple Hello world ARM example on my desktop computer. I tried both qemu and gem5. Both gives a similar error. They cannot find ld-linux-aarch64.so.1. Actually I cannot find it either. If I could find it, I will show it with -L (in qemu) or --redirects (in gem5).

The file is:

armhello: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=23a21b7a545ac510923b6b3713d2bbee092f820a, for GNU/Linux 3.7.0, not stripped

It is compiled with: aarch64-linux-gnu-gcc

I am trying to run it in qemu with:

qemu-aarch64 armhello

I got this error:

/lib/ld-linux-aarch64.so.1: No such file or directory

I try to run it in gem5 with: (simpleARM.py points to my executable (named as armhello))

build/ARM/gem5.opt configs/tutorial/simpleARM.py

I got this error:

panic: panic condition fd < 0 occurred: Failed to open file /lib/ld-linux-aarch64.so.1.

How can I solve this?

Note: I know it works when compiled --static. But I need to run more complex binaries that are dynamically linked and I cannot change those. This is just an example.


Solution

  • For gem5 you can use --redirects and --interp-dir: How to run a dynamically linked executable syscall emulation mode se.py in gem5?

    For qemu you need -L: Using dynamic linker with qemu-arm