linuxx86windows-subsystem-for-linux32-bit

Does WSL 2 really support 32 bit program?


I have googled this problem, some answers declared that WSL 2 now supports ELF 32 program.

However, a simple test on wsl2 Debian/Ubuntu distro was not passed.

Here is my test:

// install run-time
sudo dpkg --add-architecture i386
sudo apt-get update
// install build tools
sudo apt install build-essential
sudo apt install gcc-multilib
// build
gcc helloworld.c  -m32
// run!
./a.out
bash: ./a.out: cannot execute binary file: Exec format error

refers:


Solution

  • If you run the command uname -a in WSL you should get a result that contains the version of your WSL. This should be something like Linux COMPUTER_NAME 4.4.0-18362-Microsoft .... the number 18362 in that output is your WSL version and it needs to be at least 19041 to be a WSL2 build (only WSL2 supports 32-bit apps).

    You could also run wsl --list --verbose in a CMD shell and you will see the version of your WSL instance is 1.

    WSL2 will be part of the Windows update later this month

    WSL2 will be released as part of Windows 10 2004 on May 12, 2020. If you don't want to wait you can sign up for the preview builds through the "Windows Insider Program".

    Get WSL2 through Windows Insider Program now (about 1 hour of work):

    I just did all of this over the last hour, because I needed to run a Zephyr simulation binary I built this morning. It worked, and I am very happy :)

    Sources:

    Github issue - scroll to end

    Install WSL2