摘要:本篇教程探讨了Windows运维之Win10 Ubuntu子系统运行32bit Linux原生程序,希望阅读本篇文章以后大家有所收获,帮助大家对相关内容的理解更加深入。
本篇教程探讨了Windows运维之Win10 Ubuntu子系统运行32bit Linux原生程序,希望阅读本篇文章以后大家有所收获,帮助大家对相关内容的理解更加深入。
<
本文主要描述的是:解决 Win10 Ubuntu子系统中运行 32bit Linux原生程序 报错 Exec format error 。
问题来源于 在 Win10 Ubuntu子系统中运行 Linux原生交叉编译器 32bit gcc 。
解压gcc 后直接运行
./arm-linux-gcc -v 报错 : Exec format error
按照常规方式 : 原生 Ubuntu 添加 32bit 运行环境
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386
sudo apt-get install lib32ncurses5 lib32ncurses5-dev
sudo apt-get install lib32z1
并没有解决问题。
报错同样是 Exec format error
通过 readelf -a arm-linux-gcc 检查程序导出表发现问题
readelf 命令报错:Not an ELF file - it has the wrong magic bytes at the start
初步确定问题来源,子系统不支持原生linux文件头。
而后通过搜索此错误找到相关english网页。 此问题。
解决方式如下:
添加xxx形式文件头支持
1 sudo apt update
2 sudo apt install qemu-user-static
3 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'
本文由职坐标整理发布,学习更多的相关知识,请关注职坐标IT知识库!
您输入的评论内容中包含违禁敏感词
我知道了
请输入正确的手机号码
请输入正确的验证码
您今天的短信下发次数太多了,明天再试试吧!
我们会在第一时间安排职业规划师联系您!
您也可以联系我们的职业规划师咨询:
版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
沪公网安备 31011502005948号