Running Debian i386 binary on Debian armel via qemu

9,474

Solution 1

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.

Solution 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
Share:
9,474

Related videos on Youtube

muncherelli
Author by

muncherelli

Updated on September 18, 2022

Comments

  • muncherelli
    muncherelli almost 2 years

    I am trying to follow this guide to set up a Ventrilo server on my SheevaPlug, running Debian armel. This page states that I can use QEMU to run the binary that was made for i386 on my arm system.

    The setup for qemu says that I need to install qemu, qemu-user, and qemu-libc-i386. I found the first two in apt-get, but qemu-libc-i386 is not a package. So I tried to run qemu to run ventrilo server like this:

    # qemu-i386 ./ventrilo_srv
    /lib/ld-linux.so.2: No such file or directory
    

    It seems that ld-linux.so.2 is the i386 version of what I have in armel as ld-linux.so.3.

    So I know the how-to is for a different distribution of Linux, but it seems that I should be able to get this running in Debian if they could in their crazy distro. Is there a package that I can get that will install the libc-i386 so I can get this to run (similar to ia32-libs for an x64 system?) I tried also copying the so.2 from another i386 system and that didn't get me anywhere.

    • sr_
      sr_ over 12 years
      Concerning your problem, if you're not dependent on this VOIP server, there are Free Software VoIP-server solutions, some already packaged for Debian/armel.
    • muncherelli
      muncherelli over 12 years
      Right- I mean I could use mumble or something, but its more of a "can I get it to work this way" than I need a solution to a problem.