64位ubuntu从apt-get安装32位软件

运行luac的截图

缘由

昨天搞了个lua编译下载工具,发现luac下载到mcu进去之后显示size_t size mismatch in precompiled chunk,网上查了查居然说是x86x64的lua字节码不兼容,必须要32位的luac来编译才行

步骤

其实直接从apt装一个新的lua就行了

卸载当前版本

sudo apt remove lua5.3

加上x86的软件源

sudo dpkg --add-architecture i386

更新一下

sudo apt-get update

安装x86版本的lua5.3

sudo apt-get install lua5.3:i386

其他软件也是同理

后续

因为我用的是wsl,运行32位软件居然报luac5.3 cannot execute binary file: Exec format error

。。。。。。。

草(一种植物)

其实wsl跑x86程序,可以参考GitHub上面的解决办法

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'

每次开启终端后跑一下这个就行了(加到~/.bashrc~/.zshrc里)

sudo service binfmt-support start

完美运行

运行luac的截图

4 Comments

发表评论

您的电子邮箱地址不会被公开。