Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save shooley/24e869265738e3fa98656eae1b7a9669 to your computer and use it in GitHub Desktop.
Save shooley/24e869265738e3fa98656eae1b7a9669 to your computer and use it in GitHub Desktop.
Bulding Go binaries for Raspberry Pi

To build a binary that will run on the Raspberry Pi, you need to have a Go cross compiler and enable it when building the executable.

To build the cross compiler for Linux/ARM (you only need to do this once):

cd /usr/local/go/src
sudo GOOS=linux GOARCH=arm ./make.bash --no-clean

Once you've done that, you can build a binary for Raspberry Pi:

env GOOS=linux GOARCH=arm go build -o <target_executable> <source_file>

source: http://stackoverflow.com/questions/12168873/cross-compile-go-on-osx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment