英文:
Golang. Cross Compiling for MIPS
问题
我尝试在我的64位Debian Linux PC上根据文档https://golang.org/doc/install/source#environment,将我的简单程序编译为MIPS架构。我使用了以下命令:
GOOS=linux GOARCH=mipsle go build
GOOS=linux GOARCH=mips go build
但每次都会出现错误:
runtime/internal/sys compile
未知的架构“mipsle(mips)”
有趣的是,如果我尝试使用以下命令:
GOOS=linux GOARCH=mipsle64 go build
程序可以成功构建。
这是否取决于我的PC上的操作系统?我如何为MIPS或MIPSLE构建二进制文件?
英文:
I have tried compiling my simply program:
func main(){fmt.Printf("Hello")}
to MIPS architecture on my PC wit 64 bit Debian Linux according to documentation
https://golang.org/doc/install/source#environment
via using command
GOOS=linux GOARCH=mipsle go build
GOOS=linux GOARCH=mips go build
Every time I get the error:
> runtime/internal/sys compile
>
> unknown architecture "mipsle(mips)"
The interesting thing is, if a try using command:
GOOS=linux GOARCH=mipsle64 go build
The program was build.
Is it dependent on system OS on my PC ? How can I build a binary for MIPS or MIPSLE ?
答案1
得分: 3
Go 1.6不支持MIPS或MIPSLE。1.6支持MIPS64(LE)。1.8支持MIPS(LE)。
从https://golang.org/doc/install/source:
- amd64(也称为x86-64)
- 一个成熟的实现。
- 386(x86或x86-32)
- 与amd64端口相当。
- arm(ARM)
- 支持Linux、FreeBSD、NetBSD、OpenBSD和Darwin二进制文件。使用比其他端口少。
- arm64(AArch64)
- 支持Linux和Darwin二进制文件。1.5中新增,与其他端口相比使用较少。
- ppc64、ppc64le(64位PowerPC大端和小端)
- 支持Linux二进制文件。1.5中新增,与其他端口相比使用较少。
- mips、mipsle(32位MIPS大端和小端)
- 支持Linux二进制文件。1.8中新增,与其他端口相比使用较少。
- mips64、mips64le(64位MIPS大端和小端)
- 支持Linux二进制文件。1.6中新增,与其他端口相比使用较少。
- s390x(IBM System z)
- 支持Linux二进制文件。1.7中新增,与其他端口相比使用较少。
英文:
Go 1.6 does not support MIPS or MIPSLE. 1.6 supports MIPS64(LE). 1.8 supports MIPS(LE).
From https://golang.org/doc/install/source:
> * amd64 (also known as x86-64)
> * A mature implementation.
> * 386 (x86 or x86-32)
> * Comparable to the amd64 port.
> * arm (ARM)
> * Supports Linux, FreeBSD, NetBSD, OpenBSD and Darwin binaries. Less widely used than the other ports.
> * arm64 (AArch64)
> * Supports Linux and Darwin binaries. New in 1.5 and not as well exercised as other ports.
> * ppc64, ppc64le (64-bit PowerPC big- and little-endian)
> * Supports Linux binaries. New in 1.5 and not as well exercised as other ports.
> * mips, mipsle (32-bit MIPS big- and little-endian)
> * Supports Linux binaries. New in 1.8 and not as well exercised as other ports.
> * mips64, mips64le (64-bit MIPS big- and little-endian)
> * Supports Linux binaries. New in 1.6 and not as well exercised as other ports.
> * s390x (IBM System z)
> * Supports Linux binaries. New in 1.7 and not as well exercised as other ports.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论