为ARM打造? 设置GOBIN后,无法通过`go install`进行交叉编译

Whenever I try and use 'go install' after settings goarch, goos and gobin I get 'cannot install cross-compiled binaries when GOBIN is set', but don't understand why?

What's the simplest way to build for arm linux?

You can use the go build command instead:

env GOOS=android GOARCH=arm64 go build -o /arm64bins/app

Available GOOS/GOARCH's in Go 1.7:

➜ go tool dist list | grep arm                                                                                   05/29/16
android/arm
android/arm64
darwin/arm
darwin/arm64
freebsd/arm
linux/arm
linux/arm64
nacl/arm
netbsd/arm
openbsd/arm
plan9/arm

this works for me(cross compilation from win64 to linux arm6):
I first set these in terminal:

set GOARCH=arm
set GOBIN=D:\work\go\bin
set GOEXE=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=linux
set GOPATH=D:\work\go
set GORACE=
set GOROOT=c:\go
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GO15VENDOREXPERIMENT=1
set CC=gcc
set GOGCCFLAGS=-fPIC -marm -fmessage-length=0
set CXX=g++
set CGO_ENABLED=0

and then simply:
go build
and it generates binary output for target (ok).
then copy binary output to the target system and run.
I think you should use "go build" not "go install" for cross compilation.

env GOOS=android GOARCH=arm64 go build test.go return error

# command-line-arguments 
/usr/lib/go-1.10/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/usr/bin/x86_64-linux-gnu-ld: /tmp/go-link-711744324/go.o: Relocations in generic ELF (EM: 183)
/tmp/go-link-711744324/go.o: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status