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 Overflowyou 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
$ export QEMU_LD_PREFIX=/usr/arm-linux-gnueabi
This works for me. It's basically the same thing as:
$ qemu-arm -L /usr/arm-linux-gnueabi/
You can add it to the ~/.bashrc file so you don't have to type it everytime you open the terminal.
multiarch build works for amd64 and arm64 but not for arm/v7 ("qemu-arm: Could not open '/lib/ld-linux.so.3'")
Multi-architecture docker build produces binary that fails to execute due to QEMU lib error
Need help: /lib/ld-linux-armhf.so.3: No such file or directory
ubuntu - u-boot /lib/ld-linux-armhf.so.3: No such file or directory - Stack Overflow
after installing libc6-armhf-cross
sudo ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /usr/lib/ld-linux-armhf.so.3 or update the library path
The problem is that you don’t have the libraries of arm, a quick and useful solution will be compiling with -static. For example:
$ arm-linux-gnueabihf-gcc -static -o name program.s
$ qemu-arm name
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!
/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.
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.
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