donglu9978
2012-01-11 17:15
浏览 58
已采纳

我的Go工具是否针对错误的体系结构构建?

I'm a big fan of Go language, and now I am trying to explore other architectures than x86/amd64. I build Go for ARM, and it seems to have good support for that target. All libraries build successfully, and tests fail (because it's trying to run ARM test binaries on my amd64 system).

After all, I have 5g/5l in my $GOBIN folder and they produce valid and working ARM binaries. But what's happening to other Go tools:

5a:        ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
5c:        ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
5g:        ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
5l:        ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
6cov:      ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
6nm:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
6prof:     ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
cgo:       ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
ebnflint:  ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
godefs:    ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
godoc:     ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
gofix:     ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
gofmt:     ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
goinstall: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
gomake:    POSIX shell script, ASCII text executable
gopack:    ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
gopprof:   a perl script, ASCII text executable
gotest:    ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
gotry:     a bash script, ASCII text executable
gotype:    ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
govet:     ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
goyacc:    ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped
hgpatch:   ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped

See? cgo is an ARM binary, gofix and gofmt are ARM binaries as well. I thought it's expected that if I provide $GOHOSTOS/$GOHOSTARCH variables I will cross-compile my apps? How to get cgo work for ARM target?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongqiang2024 2012-01-11 18:16
    已采纳

    The Go linux/arm port is incomplete. For example, the cgo runtime for linux/arm is unimplemented. See $GOROOT/src/pkg/runtime/cgo/gcc_arm.S and $GOROOT/src/pkg/runtime/cgo/gcc_linux_arm.c.

    [cgo on arm.] It is not planned for Go 1.

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题