Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building for ARM? Cannot do cross-compilation with `go install` when GOBIN is set

Tags:

go

arm

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?

like image 805
Jacob Mason Avatar asked May 28 '16 19:05

Jacob Mason


1 Answers

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
like image 97
OneOfOne Avatar answered Sep 27 '22 19:09

OneOfOne