Skip to content

Instantly share code, notes, and snippets.

:octocat:

Daniel Morandini jecoz

:octocat:
Block or report user

Report or block jecoz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jecoz
jecoz / crossgo.md
Last active May 2, 2020
Notes on cross compiling a Go distribution
View crossgo.md

If you cannot get Go installed on your device either because a binary distribution is missing or there are not enough resources (ram, disk space) to directly compile it from source, but your target operating system and CPU architecture are supported, you can still do a cross-compilation from a host that has a working Go installation on it! There are some things you have to take care of, I thought it was worth sharing them.

Go compiles itself after version 1.4, probabily you need a different approach if you target a previous version.

From this point on, I'll call host the device where you have Go available, target the one where you would like it to be (in my case a raspberry Pi 2 running FreeBSD).

On the host

First we need to get the source from somewhere (here I'm following the official guide)

$ git clone https://go.googlesource.com/go goroot
View keybase.md

Keybase proof

I hereby claim:

  • I am jecoz on github.
  • I am jecoz (https://keybase.io/jecoz) on keybase.
  • I have a public key ASAPzD3B7xgCwOjdGEWvpqx1iZCVG4AoFi86rZAOB3GdjQo

To claim this, I am signing this object:

You can’t perform that action at this time.