I have a pretty simple application that was compiled with g++ -m32 flags.

Unfortunately, when I try to run it I am getting error:

bash: ./a.out: cannot execute binary file: Exec format error

If compiled without -m32 there is no error and it runs as expected.

What can be a problem and is it possible to solve it?


  1. Compiling with g++ -m32 --static doesn't solve the issue.
  2. Setup is Ubuntu sub-system on Windows 10.
  • Did you try with --static too? Moreover specify where you compiled (under which OS) and where you are running it (if under cygwin or similar, native Linux, Ubuntu shell under Win10...etc etc). It may result useful the output of file a.out too.
    – Hastur
    Feb 20, 2019 at 11:35
  • @Hastur, see the edit.
    – Alex
    Feb 20, 2019 at 11:48
  • 1
    How to run 32-bit app in Ubuntu 64-bit?
    – Seth
    Feb 20, 2019 at 11:53
  • @Seth, tried even before asking. Probably the point is that it is not a normal Ubuntu, but Ubuntu on Windows
    – Alex
    Feb 20, 2019 at 13:38
  • @Alex What did or didn't work about it? You're probably missing a 32 bit libraries, subsystem or similar for linux and can't run 32 bit executable unless you install it (which you might not be able to do).
    – Seth
    Feb 20, 2019 at 13:54

2 Answers 2


Update (WSL2)

WSL2 runs in a real virtual machine using a real Linux kernel, so it's actually possible to do anything a Linux VM can do, including running 32-bit code. Just install 32-bit libs by running

sudo dpkg --add-architecture i386
sudo apt-get update

But again, you should really opt for the 64-bit version, especially if you have the source code. 32-bit Linux is much less maintained than the 64-bit version, since there are far fewer 32-bit only hardware in the last decade along with a significantly less number of users and testers. One example is that the Meltdown/Spectre patch for 32-bit Linux came out more than half a year later than the 64-bit version, and it's still buggy for years later

Original Answer

You simply can't do that. WSL doesn't support 32-bit apps!

Most (if not all) Intel and AMD CPUs in the last decade support the x86_64 instruction set and there's no reason for Microsoft to spend time and money on supporting a 32-bit version of Linux. Most developers and Ubuntu users are running the 64-bit version anyway

No, we don’t support x86 32-bit at this time: We currently depend on x64-only instructions and mechanisms to ensure fast & stable performance.

Bash on Ubuntu on Windows

  • 2
    I am using WSL to build and run unit tests for an ARM platform, which is 32 bit, and hence has certain equivalences of word size between 32-bit data types and pointers, which do not exist when running in a 64-bit system. Hence this omission is annoying !
    – MikeW
    May 15, 2019 at 15:45
  • Sry, but can you test on WSL2 if 32bit program can run. I have build a hello world program and still got the error. FIle info stack_example: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 3.2.0, BuildID[sha1]=2b667381aff3f1963c09a040c2c1f28afe3526d2, not stripped Apr 19, 2020 at 5:46

In addition to the answer for wsl 2, I also had to install sudo apt-get install gcc-multilib so libc6 have been installed and ELF 32bit can be executed

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.