On my Ubuntu 18.04 machine, I am using qemu-arm to execute a 32-bit ELF file for ARM platform as shown below:

$ file bin
bin: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.2.0, BuildID[sha1]=5018caf41114f911f0a0fd09c4f9a0bb1191c87a, not stripped

$ qemu-arm bin
bin: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

On another machine which has an ARM processor, I get the following output by running ldd on the binary:

$ ldd bin
    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xb6e25000)
    /lib/ld-linux-armhf.so.3 (0xb6f11000)

On my Linux machine, I have installed: ld-linux-armhf.so.3 and its located in the path: /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3

$ ls -l /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3
lrwxrwxrwx 1 root root 10 Feb 25  2014 /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 -> ld-2.19.so

I created the symlink:

$ sudo ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux-armhf.so.3

However, even then the binary does not execute because it is unable to find and load the file, libc.so.6.

How do I resolve this?

  • How did you install ld-linux-armhf.so.3? I am running into this issue right now. I'm on a x86_64 Ubuntu VM 16.04 and I'd like to run a binary with qemu-arm that has a similar file output to yours except mine is stripped: bin: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, stripped
    – LeanMan
    May 18 '20 at 20:50

Prefix the LD_LIBRARY_PATH with /lib/arm-linux-gnueabihf: (or just set it to /lib/arm-linux-gnueabihf if it's empty on the line invoking the executable:

LD_LIBRARY_PATH=/lib/arm-linux-gnueabihf qemu-arm bin

That should allow the executable to find the file.

  • Thanks, it works.
    – Neon Flash
    May 20 '19 at 12:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.