you can run the example by providing a path to the arm-linux-gnueabi shared libs using the -L flag.

qemu-arm -L /usr/arm-linux-gnueabi/

also make sure the LD_LIBRARY_PATH is not set.

unset LD_LIBRARY_PATH
Answer from vivek_v on Stack Overflow
🌐
The Mail Archive
mail-archive.com › debian-bugs-dist@lists.debian.org › msg1833231.html
Bug#1001156: qemu-arm needs some help with finding libs
December 5, 2021 - Both seem to be necessary to run a binary: setting LD_LIBRARY_PATH and providing ld-linux-armhf.so.3 in /lib/ . It should work without these steps. -rbk. -- .''`. Richard B. Kreckel : :' : <[email protected]> `. `' <[email protected]> `- <http://in.terlu.de/~kreckel/> ... Bug#1001156: qemu-arm ...
Discussions

multiarch build works for amd64 and arm64 but not for arm/v7 ("qemu-arm: Could not open '/lib/ld-linux.so.3'")
Hello! This Dockerfile when run using docker buildx --platform linux/arm/v7,linux/arm64/v8,linux/amd64 . fails on the arm/v7 build with this error: qemu-arm: Could not open '/lib/ld-linux.so.3&... More on github.com
🌐 github.com
5
July 20, 2022
Multi-architecture docker build produces binary that fails to execute due to QEMU lib error
I ended up at this issue when I could not get my .net 7.0 builds to compile using amd64 and arm64 environments. I followed the mixture of advice in the issue and this blog post, and I am now buildi... More on github.com
🌐 github.com
4
1
April 10, 2023
Need help: /lib/ld-linux-armhf.so.3: No such file or directory
I have Eclipse CDT and Linaro 7.3.1 installed on my Ubuntu x64 machine. Then, I install some other tools like QEMU and the different architectures for ARM after this guide: http://exploringbeaglebone.com/chapter7/ Next… More on forum.beagleboard.org
🌐 forum.beagleboard.org
0
0
September 3, 2018
ubuntu - u-boot /lib/ld-linux-armhf.so.3: No such file or directory - Stack Overflow
My machine Ubuntu 16.04.3 LTS x86_64. I do compile u-boot-2017.11 and I got the error. u-boot-2017.11$ export ARCH=arm u-boot-2017.11$ export CROSS_COMPILE=/opt/toolchains/gcc-linaro-4.9.4-2017.01- More on stackoverflow.com
🌐 stackoverflow.com
🌐
Google Groups
groups.google.com › g › linux.debian.bugs.dist › c › 6P4cw8mMwO4
Bug#1001156: qemu-arm needs some help with finding libs
> > Say, do users have to export LD_LIBRARY_PATH=/usr/arm-linux-gnueabihf/lib? No. The libraries in /usr/arm-linux-gnueabihf/lib are for cross-compiling. You don't even need to install them for just running binaries. > I am asking because without it I am getting > a.out: error while loading shared libraries: libstdc++.so.6: cannot open > shared object file: No such file or directory > > when running qemu-arm a.out. (libstdc++6-armhf-cross is installed.)
🌐
GitHub
github.com › docker › buildx › issues › 1222
multiarch build works for amd64 and arm64 but not for arm/v7 ("qemu-arm: Could not open '/lib/ld-linux.so.3'") · Issue #1222 · docker/buildx
July 20, 2022 - multiarch build works for amd64 and arm64 but not for arm/v7 ("qemu-arm: Could not open '/lib/ld-linux.so.3'")#1222 ... Various similar reports imply that linking the .so from a package called libc6-armhf-cross might help, but I couldn't get that to work.
Author   docker
🌐
> TRIPLA SECURITY
tripla.dk › 2020 › 03 › 14 › running-arm-binaries-on-x86-with-qemu
Running ARM binaries on Ubuntu x86 with QEMU – > TRIPLA SECURITY
October 22, 2022 - The error complains that the library cannot be found in the lib folder (“/lib/ld-linux-armhf.so.3: No such file or directory”). If we copy it to the /lib folder, we can indeed see that the error message changes, however we don’t want to copy all required libraries for all our projects to the /lib folder as this can grow really fast. x@ubuntu: ./qemu-arm-static httpd /lib/ld-linux-armhf.so.3: No such file or directory x@ubuntu: sudo cp ld-linux-armhf.so.3 /lib/ x@ubuntu: ./qemu-arm-static httpd httpd: error while loading shared libraries: libcms_dal.so: cannot open shared object file: No such file or directory
🌐
Debian User Forums
forums.debian.net › viewtopic.php
[SOLVED] Sorting out qemu in Stretch/testing - Debian User Forums
September 18, 2016 - sudo aptitude install qemu-user-static ... using qemu as I have in the past under a Debian Jessie install (but running the 4.7 kernel (i'm running a Skylake machine)) but now under Stretch/testing I get this: /lib/ld-linux-armhf.so.3: No such file or directory A search on my machine indicates the file is located here: /usr/arm-linux-gnu...
🌐
The Mail Archive
mail-archive.com › debian-bugs-closed@lists.debian.org › msg698267.html
Bug#1001156: marked as done (qemu-arm needs some help with finding libs)
Both seem to be necessary to run a binary: setting LD_LIBRARY_PATH and providing ld-linux-armhf.so.3 in /lib/ . It should work without these steps. -rbk. -- .''`. Richard B. Kreckel : :' : <krec...@debian.org> `. `' <krec...@in.terlu.de> `- <http://in.terlu.de/~kreckel/> --- End Message --- ...
Find elsewhere
🌐
GitHub
github.com › dotnet › dotnet-docker › discussions › 4552
Multi-architecture docker build produces binary that fails to execute due to QEMU lib error · dotnet/dotnet-docker · Discussion #4552
April 10, 2023 - #27 [linux/amd64->arm/v7 builder 10/10] RUN ./Publish/PlexCleaner/PlexCleaner --version #0 0.116 qemu-arm: Could not open '/lib/ld-linux-armhf.so.3': No such file or directory #27 ERROR: process "/bin/sh -c ./Publish/PlexCleaner/PlexCleaner --version" did not complete successfully: exit code: 255
Author   dotnet
🌐
BeagleBoard
forum.beagleboard.org › googlegroups
Need help: /lib/ld-linux-armhf.so.3: No such file or directory - GoogleGroups - BeagleBoard
September 3, 2018 - I have Eclipse CDT and Linaro 7.3.1 installed on my Ubuntu x64 machine. Then, I install some other tools like QEMU and the different architectures for ARM after this guide: http://exploringbeaglebone.com/chapter7/ Next, I follow this video to start a Hello World code: https://www.youtube.com/watch?v=T9yFyWsyyGk&t=1060s The code builds without problem.
🌐
Gentoo Forums
forums.gentoo.org › viewtopic-t-1035274-start-0.html
Gentoo Forums :: View topic - qemu-arm hello world fail [SOLVED]
December 14, 2015 - FAQ | Search | Memberlist | Usergroups | Statistics | Profile | Log in to check your private messages | Log in | Register · Links: forums.gentoo.org | www.gentoo.org | bugs.gentoo.org | wiki.gentoo.org | forum-mods@gentoo.org
🌐
GitHub
github.com › open-source-parsers › jsoncpp › issues › 1438
qemu-arm: Could not open '/lib/ld-linux.so.3': No such file or directory · Issue #1438 · open-source-parsers/jsoncpp
October 10, 2022 - I'm trying to cross-compile for the armv7l architecture using the compiler arm-linux-gnueabi-g++. Founding the issue #243 can be used as reference to try an approach, so i ran: Using this file as toolchain file. mkdir build cd build cmak...
Author   open-source-parsers
Top answer
1 of 2
7

It looks like the system is not able to find the dynamic linker (which in your case appears to be /system/bin/linker, rather than the the normal /lib/ld-linux-armhf.so.3 or similar.

Since I don't have access to your code, I've tried to reproduce this by mounting a Raspberry Pi "Raspbian" image on /mnt on my system. If I try to run /mnt/bin/echo hello, like this:

qemu-arm  /mnt/bin/echo hello

I get a similar error:

/lib/ld-linux-armhf.so.3: No such file or directory

I can provide an explicit path to the dynamic linker like this:

qemu-arm  /mnt/lib/ld-linux-armhf.so.3 /mnt/bin/echo hello

Now I get a different error:

/mnt/bin/echo: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

That's actually great, because that is a normal "I can't find my shared libraries" error, and the solution is to use LD_LIBRARY_PATH. Rather than setting this in our environment, we can set this in the environment created by qemu-arm with the -E flag:

qemu-arm -E LD_LIBRARY_PATH=/mnt/lib/arm-linux-gnueabihf/  /mnt/lib/ld-linux-armhf.so.3 /mnt/bin/echo hello

Which gets me the output:

hello

I suspect that these same two techniques -- providing an explicit path to the linker, and providing an explicit library search path in LD_LIBRARY_PATH -- may help you out. Let me know how it works!

2 of 2
2

/system/bin/linker is the Android dynamic linker, so you need a directory with the Android dynamic linker and dynamic libraries, not one for Linux (which is what /usr/arm-linux-gnueabi will be). You should be able to pull the relevant files out of your firmware image, I expect.

Top answer
1 of 2
5

Yes, you can run x86 binaries in QEmu with QEmu running on an ARM processor. It will be very slow, because QEmu does software emulation of the x86 processor, and you may find yourself short of RAM, but it can work.

The qemu-user package contains the virtual machine itself, i.e. an emulator of an x86 processor and some hardware devices and a Linux kernel running on that harwdare. (The qemu-system package contains an emulator of just the hardware on which you can install the operating system of your choice.) You still need to populate the virtual machine with a runtime environment, including /lib/ld-linux.so.2 (the dynamic loader, necessary to run any dynamically linked executable) and a bunch of libraries. This is what the qemu-libc-i386 package on Optware provides. It is somewhat similar to ia32-libs on amd64 systems, but that is a lot simpler because an amd64 processor can execute i386 binaries natively; here you need to have the libraries inside the x86 VM.

You can try grabbing the qemu-libc-i386 package from Optware. The Optware package format is very close to Debian's, so you can convert the ipk to a deb manually:

mkdir tmp
wget http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/qemu-libc-i386_2.3.6-1_arm.ipk
tar xzf qemu-libc-i386_2.3.6-1_arm.ipk
ar rc qemu-libc-i386_2.3.6-1_arm.deb debian-binary control.tar.gz data.tar.gz 

I don't guarantee that this will work. You'll may need to ensure that the versions of QEmu match.

If installing the modified ipk doesn't work, try reproducing its contents on your system. Unpack data.tar.gz somewhere (or get the same files from some other x86 system), see what the postinst script in control.tar.gz does, and supply the proper paths to qemu-i386.

2 of 2
2

I resolved on my ARM device by copying my PC i386 ld-linux.so.2 as below :

scp /lib/ld-linux.so.2 [email protected]:/lib

and then by copying all the needed shared libraries. In my case, I've organized all of them in a new folder inside my device before copying them :

mkdir /lib/i386-linux-gnu
scp /usr/lib/i386-linux-gnu/libstdc++.so.6 [device]:/lib/i386-linux-gnu
scp /usr/lib/i386-linux-gnu/libgcc_s.so.1 [device]:/lib/i386-linux-gnu
scp /usr/lib/i386-linux-gnu/libc.so.6 [device]:/lib/i386-linux-gnu
scp /usr/lib/i386-linux-gnu/libm.so.6 [device]:/lib/i386-linux-gnu
🌐
GitHub
github.com › conan-io › conan › issues › 16070
[question] Cross-compiling with arm toolchain and unit tests · Issue #16070 · conan-io/conan
April 11, 2024 - qemu-aarch64: Could not open '/lib/ld-linux-aarch64.so.1': No such file or directory LD_LIBRARY_PATH=+/home/user/.conan2/p/b/armtoa3ace3b2f5614/p/lib: CMake Error at /usr/share/cmake/Modules/GoogleTestAddTests.cmake:78 (message): Error running test executable.
Author   conan-io