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

Viewed 13878

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.

2 Answers

same problem on x86_64 machine docker build with an arm64 docker image:

FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu

FROM alpine

COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/
# add this line to resolve
RUN apk add libc6-compat
Related