[英]golang binary not running on mips
我在 Windows 10 上使用 Go 1.11.4,我想为运行 Linux 的 MIPS 74Kc 处理器(Qualcomm Atheros QCA9558)编译代码。 我编译:
GOOS=linux GOARCH=mips go build
获取可执行文件,上传并运行它并获得:
Illegal instruction
用GOARCH=mipsle
再试一次,得到:
./hello_mipsle_linux: line 1: syntax error: unexpected "("
我错过了什么?
我的主机进行构建时有一个 FPU,但电路板没有。 添加GOMIPS=softfloat
修复它:
GOOS=linux GOARCH=mips GOMIPS=softfloat go build
要列出当前构建工具链可用的所有可能的 MIPS 架构师,请使用go tool
例如
$ go version
go version go1.12 darwin/amd64
$ go tool dist list | grep mips
linux/mips
linux/mips64
linux/mips64le
linux/mipsle
所以可能是您还没有尝试过的其余GOARCH
排列之一,例如mips64
或mips64le
。
uname -m
将有助于确定您的目标系统的机器架构。
我有一个类似的问题,它已通过设置GOARCH=mipsle
解决。 这应该工作
GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build
我的核心是MIPS 24KEc V5.0
,看我的博客https://zyfdegh.github.io/post/202002-go-compile-for-mips/
如果不行,请尝试以下步骤
$ lscpu | grep "Byte Order"
cat /proc/cpuinfo
也会有帮助。
$ uname -a
Linux OpenWrt 4.14.151 #0 Tue Nov 5 14:12:18 2019 mips GNU/Linux
GOARCH=mipsle
,如果是 64bit Little-Endian,设置 set GOARCH=mips64le
另一个相关问题为 OpenWrt 编写和编译程序希望它有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.