Exec format error 32-bit executable Windows Subsystem for Linux?

前端 未结 3 1575
温柔的废话
温柔的废话 2020-12-01 07:02

When I try to execute a 32-bit file compiled with gcc -m32 main.c -o main on Windows Subsystem for Linux, I get the following error: bash: ./main

3条回答
  •  北海茫月
    2020-12-01 07:22

    WSL2 runs in a real virtual machine using a real Linux kernel, therefore 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
    

    For more information read

    • Announcing WSL 2
    • WSL 2 FAQ

提交回复
热议问题