我用谷歌搜索了这个问题,一些答案声明 WSL 2 现在支持 ELF 32 程序。
然而,在wsl2 Debian/Ubuntu发行版上的简单测试没有通过。
这是我的测试:
// 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:
https://stackoverflow.com/questions/42120938/exec-format-error-32-bit-executable-windows-subsystem-for-linux
https://superuser.com/questions/1407730/run-32-bit-application-on-ubuntu-on-windows-subsystem-for-linux/1407818#1407818
如果您运行命令uname -a
在 WSL 中,您应该得到包含 WSL 版本的结果。这应该是这样的Linux COMPUTER_NAME 4.4.0-18362-Microsoft ...
。该输出中的数字 18362 是您的 WSL 版本,并且它需要至少为 19041 才能成为 WSL2 版本(仅 WSL2 支持 32 位应用程序)。
你也可以运行wsl --list --verbose
在 CMD shell 中,您将看到 WSL 实例的版本是1
.
WSL2 将成为本月晚些时候 Windows 更新的一部分
WSL2 将于 2020 年 5 月 12 日作为 Windows 10 2004 的一部分发布。如果您不想等待,可以通过“Windows Insider 计划”注册预览版本。
立即通过 Windows Insider 计划获取 WSL2(大约需要 1 小时):
我在过去一个小时内完成了所有这些工作,因为我需要运行今天早上构建的 Zephyr 模拟二进制文件。它成功了,我很高兴:)
Sources:
Github 问题 - 滚动到末尾
安装 WSL2
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)