1

I compiled a 32-bit executable for a Linux machine. It runs on most Linux distros without trouble. However, on Ubuntu 16.04 LTS, I get the No such file or directory error when trying to execute it. The executable is present in the directory and has all the relevant permissions set.

There are a few answers detailing a solution to this (like here). So, I did:

  1. dpkg --print-architecture prints amd64.
  2. dpkg --print-foreign-architectures prints i386. Even with multi-arch enabled by default, I am unable to get the executable to work.

What else do I need to install/do in order to get this executable to work?

P.S: The system does not have ia32-libs installed.

AdminBee
  • 22,803
Sriram
  • 403
  • 6
    did you try running ldd /path/to/your/32-bit/binary? your ubuntu 16.04 system is probably missing the 32-bit libraries that your program needs. BTW, ia32-libs is obsolete, long replaced by multi-arch and simply installing the 32-bit versions of the libraries alongside the 64-bit version (e.g. apt-get install libc6:i386) – cas May 11 '16 at 05:42
  • 1
    also, why not just recompile your program for amd64? and make a .deb package while you're at it. – cas May 11 '16 at 05:46
  • You may create a multiarch deb. http://askubuntu.com/questions/396030/how-do-i-create-a-multiarch-deb – Rui F Ribeiro May 11 '16 at 06:12
  • @cas: Running ldd pathToBinary returns "not a dynamic executable". I could compile it against a 64-bit install too, but then it would require a lot more testing etc. and timelines are already very short. A multi-arch .deb package for a single executable? I might need to investigate that.. – Sriram May 11 '16 at 13:08
  • Also, internet access on the target systems cannot be presumed. If I install the .deb file, that means it will take the dependencies off the internet right? – Sriram May 11 '16 at 13:09
  • What does file pathToBinary say? – Stephen Kitt May 11 '16 at 18:32

1 Answers1

2

“No such file or directory” for a file that exists is a symptom of a missing loader. In your case, with a 32-bit binary on a 64-bit system, you're missing the dynamic loader /lib/ld-linux.so.2.

Having multi-arch enabled means that you can install 32-bit packages on your 64-bit system. But to actually run 32-bit executables, you need to actually install 32-bit packages. At the very least, install libc6:i386; this is the package that contains the dynamic loader. Once you do that, you may still get errors refering to missing libraries, so install the requisite 32-bit library packages (libFOO:i386).