WSL 2 真的支持 32 位程序吗? [英] Does WSL 2 really support 32 bit program?

查看:33
本文介绍了WSL 2 真的支持 32 位程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用谷歌搜索了这个问题,有些答案声称 WSL 2 现在支持 ELF 32 程序.

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

但是,在 wsl2 Debian/Ubuntu 发行版上的简单测试没有通过.

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

这是我的测试:

// 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

指:

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

推荐答案

如果你在 WSL 中运行命令 uname -a 你应该得到一个包含你的 WSL 版本的结果.这应该类似于 Linux COMPUTER_NAME 4.4.0-18362-Microsoft ....该输出中的数字 18362 是您的 WSL 版本,它需要至少为 19041 才能成为 WSL2 版本(只有 WSL2 支持 32 位应用).

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

你也可以在 CMD shell 中运行 wsl --list --verbose,你会看到你的 WSL 实例的版本是 1.

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

WSL2 将于 2020 年 5 月 12 日作为 Windows 10 2004 的一部分发布.如果您不想等待,可以通过Windows Insider Program"注册预览版本.

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

  • 在 Windows 中,转到 Settings -> Windows Insider Program 并注册该计划.然后去检查更新.下载需要一段时间,然后按照提示执行所有需要的重启等操作.

  • In Windows go to Settings -> Windows Insider Program and register for the program. Then go check for updates. It will take a while to download, then follow the prompts to do all the restarts, etc required.

确保在打开或关闭 Windows 功能

  • 这将需要很长时间.我在网上阅读后放弃了这可能需要几个小时.相反,我卸载了 Ubuntu 并重新安装了它.这花了大约 10 分钟.只要将默认设置为 WSL2,重新安装就会是 WSL2.
  • This will take a LONG time. I gave up after reading online that it could take hours. Instead I uninstalled Ubuntu and reinstalled it. That took about 10 minutes. As long as you set the default to WSL2, the re-install will be WSL2.

我在过去一小时内完成了所有这些工作,因为我需要运行今天早上构建的 Zephyr 模拟二进制文件.它奏效了,我很高兴:)

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 :)

Github 问题 - 滚动到结尾

安装 WSL2

这篇关于WSL 2 真的支持 32 位程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆