Cannot run 32-bit executable on 64-bit system with multi-arch support

9,453

“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).

Share:
9,453

Related videos on Youtube

Sriram
Author by

Sriram

Interested in learning all that is out there!!

Updated on September 18, 2022

Comments

  • Sriram
    Sriram over 1 year

    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-architecture 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.

    • Alessio
      Alessio about 8 years
      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)
    • Alessio
      Alessio about 8 years
      also, why not just recompile your program for amd64? and make a .deb package while you're at it.
    • Rui F Ribeiro
      Rui F Ribeiro about 8 years
    • Sriram
      Sriram about 8 years
      @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
      Sriram about 8 years
      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?
    • Stephen Kitt
      Stephen Kitt about 8 years
      What does file pathToBinary say?