Exec 格式错误适用于 Linux 的 32 位可执行 Windows 子系统? [英] Exec format error 32-bit executable Windows Subsystem for Linux?

查看:28
本文介绍了Exec 格式错误适用于 Linux 的 32 位可执行 Windows 子系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在 Windows Subsystem for Linux 上执行使用 gcc -m32 main.c -o main 编译的 32 位文件时,出现以下错误:bash: ./main: 无法执行二进制文件:Exec 格式错误.

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: cannot execute binary file: Exec format error.

如果我编译它没有 -m32 它会运行.

If I compile it without -m32 it runs.

在 WSL 上运行 32 位可执行文件的任何解决方案?

推荐答案

WSL(目前)不提供 32 位 ELF 支持.自从提出 UserVoice 以来,似乎没有任何进展 - 你走运了.

32-bit ELF support isn't provided by WSL (yet). There doesn't seem to be any progress since the UserVoice was raised - you are out luck.

UserVoice:请向内核添加 32 位 ELF 支持支持 32 位 i386 ELF 二进制文件.

如果可能,切换到真正的 Linux ;-)

If possible, switch to a real Linux ;-)

自从最初发布以来,WSL2 上已经提供了支持 真正的 Linux 内核!所以这应该是首选方式.

Since this was originally posted, the support has been available on WSL2 which does support real Linux kernel! So that should be the preferred way.

如链接的 github 问题所述,还有 qemu-user 如果还在使用 WSL1 就可以使用.

As noted in the linked github issue, there's also qemu-user which can be used if WSL1 is still used.

这篇关于Exec 格式错误适用于 Linux 的 32 位可执行 Windows 子系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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