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 directoryOn 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.soI created the symlink:
$ sudo ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux-armhf.so.3However, 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?
11 Answer
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 binThat should allow the executable to find the file.
1