Cannot Run 32-Bit Apps on 64-Bit Linux

Cannot run 32-bit apps on 64-bit Linux

You will need to install the 32bit library package

ia32-libs - ia32 shared libraries for use on amd64 and ia64 systems

go and execute

sudo aptitude install ia32-libs

How to Compile 32-bit Apps on 64-bit Ubuntu?

To get Ubuntu Server 12.04 LTS 64-bit to compile gcc 4.8 32-bit programs, you'll need to do two things.

  1. Make sure all the 32-bit gcc 4.8 development tools are completely installed:

    sudo apt-get install lib32gcc-4.8-dev

  2. Compile programs using the -m32 flag

    gcc pgm.c -m32 -o pgm

Trying (and failing) to run Hello World 32-bit C++ program on 64-bit Ubuntu on Windows 10

It seems to me that Sam Varshavchik was right, and Ubuntu on Windows doesn't currently support 32-bit architectured programs. I installed a virtual Ubuntu 64-bit on VirtualBox, and there - using the exact same commands as described in my initial post - the program compiles and runs.

Thanks everybody for your comments

what could make 32 bit app incompatible with 64 bit linux OS?

Even setjmp and longjmp should work correctly. There are no particular issues, from a user space application, which would present any issues. The actual 32bit emulation is done by the processor. System calls are the interface back to the 64bit kernel, which Linux correctly handles.

If the application was evil, and sent executable code to another 64bit process to execute, then various things would break.

Can 32 bit and 64 bit work together?

In short: You can't link a 32-bit app to a 64-bit library.

You can run a 32-bit application, using 32-bit shared libraries on a 64-bit OS (at least all the popular 32-/64-bit processors such as AMD, Intel and Sparc). But that doesn't involve any libraries.

Longer answer: I was involved (on the outskirts) of some of the teams that designed the 64-bit Linux kernel for x86. There were briefly (compared to the whole project, the discussions lasted quite a few hours) some discussion as to how you could technically make this work. The short summary of this is that in 64-bit there are registers that aren't available in 32-bit. There is also the problem of memory addresses and the extra 32-bits in registers. All of these CAN be solved supposing the library itself "knows" that it's a 32-bit compatible library. But then we basically have a 64-bit library that is written to be a 32-bit library, and we've kind of lost the point.

The "more registers" may not apply to some processors, but the bigger address/bit-range of registers definitely apply to ALL 32- and 64-bit compatible processors. And I'm not aware of any single processor that allows a 32-bit code calling a 64-bit shared library or static library. It just doesn't work unless the code is specifically written to cope with that, which defeats the purpose of having a generic 64-bit library to support 32-bit apps.

Edit:

The above discusses linking one executable unit, e.g. an executable file, a shared library or a static library. That has to be all "one bitness", either 32 or 64 - no mixing.

When a process that talks to another process (e.g. a GUI app which displays status from a non-GUI process that), as long as the two processes use the same protocol [and typically, IPC doesn't allow passing of pointers anyway, so 32-/64-bit conversion isn't as big an issue], you can have one process that is 32-bit and another that is 64-bit.

Installing 32 bit jvm on 64 bit linux

It appears that you cannot typically have both 64 bit and 32 bit JDK on the same Linux system (according to Oracle). If you uninstall the 64 bit and install the 32 bit using the Synaptic Package manager or by downloading from Oracle, you should be fine.

Unfortunately I'm at work and don't have my Ubuntu machine with me to test.



Related Topics



Leave a reply



Submit