8

All the questions I've seen refer to running a 32 bit app in a 64 bit system.

I'm running Ubuntu 12.04 32 bit (actually elementary OS Luna, which is based on it) and I'm trying to run a 64 bit app which refuses open. Running:

./64bit_app.run

(where 64bit_app.run is the 64 bit app I'm trying to run) results in:

bash: ./64bit_app.run: no se puede ejecutar el fichero binario

which translates to "can't execute/run/open binary file".

Should I be able to run it? Is it possible to run a 64 bit app in a 32 bit system? If so, how?

  • I have not tried this but have you attempted the solutions shown here, esoecially the answer explaining dpkg --add-architecture? As far as I know, the same approach should work for 32 on 64 and for 64 on 32. Just change dpkg --add-architecture i386 to dpkg --add-architecture amd64. – terdon Mar 6 '14 at 2:08
  • 1
    you do have 64-bit hardware, right? (just to make sure) – strugee Mar 6 '14 at 2:10
  • "which refuses open"? how exactly? – Braiam Mar 6 '14 at 2:11
  • 1
    Please read the answers to the question I linked to, you need to run sudo dpkg --add-architecture amd64 first. That's a separate command. – terdon Mar 6 '14 at 2:28
  • 1
    @terdon sorry, I did not understand that. Running that line results in: dpkg: error: opción --add-architecture desconocida where desconocida translates to unknown. – Gabriel Mar 6 '14 at 2:30
7

You can't do that directly on Linux on x86_64 with a 32bit kernel. You need a 64bit kernel to be able to run 64bit code. (Note: kernel. You can have 32bit userland running on a 64bit kernel, and install support for 64bit binaries. How easy this is depends on the distribution. Example here for Debian.)

Some virtualization software is able to do that (with restrictions on the type of CPU you're using), and emulators can do that too. But to run it natively you'll need a 64bit kernel.

Since most 64bit distributions out there have 32bit support (either by default or installable), that's what you should be using if you need to run both 64bit and 32bit binaries on the same OS.

6

Extending @Mat's answer:

Yes, some virtualization software can do it. The main obstacle to handle is that in a 32-bit environment, the 64-bit features of the CPU are not available, and also the features of a 64-bit kernel isn't available. It is even so if your CPU has 64-bit support (since around 2003, all of them have).

Your question implicitly states that you want to run the 64-bit app in your own system environment. If it is really your intention, this excludes all virtual machine-based solutions. The only remaining which is known for me is the kernel-emulation of the qemu. So:

qemu-x86_64 ./your_64bit_app

It runs your app on your current system, with your current kernel, with your current environment variables. Of course it is not very fast, it has to emulate your cpu.

It can emulate only linux x86-64 apps.

  • Somewhere I've also read, as if also vmware could do that, but this is not enough sure info for an answer. Afaik recent vmware are 64bit-only on the host side. – peterh Feb 18 at 8:33
0

Most 64-bit architectures are extensions to the 32-bit ones. They're newer and completely different so obviously a 32-bit architecture has no idea what the 64-bit counterpart is. They don't know what the new features are, what new registers there are... Even if they know, they have no access to the new registers and features. As a result a 32-bit kernel can't save 64-bit contexts. All of that makes running 64-bit apps on a 32-bit system impossible.

A carefully crafted 64-bit-aware 32-bit kernel can run 64-bit apps but it still needs some 64-bit code to do the context savings, which makes it not a pure 32-bit kernel anymore.

You can run a 64-bit OS inside an emulator, or a 64-bit guest virtual machine inside 32-bit host with VT-x. But technically you're running in a different 64-bit system. It's still not possible to run 64-bit code directly on 32-bit Linux kernel

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.