首页 > Windows开发 > 详细

Bash On Windows(WSL)无法运行32Bit程序,报错cannot execute binary file: Exec format error解决办法

时间:2019-01-28 17:18:44      阅读:1054      评论:0      收藏:0      [点我收藏+]

一、背景

windows下用linux工具,但32位的却无法运行报错

aapt: cannot execute binary file: Exec format error
file aapt
aapt: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.24

二、解决办法

github上@Froosh给出了他的解决方案,通过安装qemu来运行32位的程序
具体步骤:
Install qemu and binfmt

sudo apt update
sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic ‘\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00‘ --mask ‘\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff‘

这一步实现了把程序的运行交由qemu-user-static来运行,从而实现运行32位

注意每次重启WSL都得重新开启,可将这步加到开机自动启动中

sudo service binfmt-support start

参考:
https://github.com/Microsoft/WSL/issues/2468

Bash On Windows(WSL)无法运行32Bit程序,报错cannot execute binary file: Exec format error解决办法

原文:https://www.cnblogs.com/TatuCz/p/10330820.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!