start | find | index | login or register | edit | ||
Sonntag, 1. April 2012 link How to cross-compile Google Go (Language) programs: The machines I work on are typically x64 boxes. A few x86 systems remain in my purview, however. Sometimes I want, on my x64 machine, cross-compile binaries to be used on legacy x86 systems. As finding how to do this with Go (1.x) took longer than necessary, here's the gist of it. Prerequisite: you already have a Go toolchain for your native architecture installed. First, install the x86 Go toolchain (compiler, linker, etc): $ go tool dist install -v cmd/8{a,c,g,l} Second, install the x86 Go runtime: $ GOARCH=386 go tool dist install -v pkg/runtime Now, you can cross-compile with plain go build by just setting the GOARCH environment variable to the desired target:$ GOARCH=386 go build hello.go Repeat the same steps with 5{a,c,g,l} and GOARCH=arm , and you'll also be able to cross-compile to ARM.no comments |
search 71 active users
backlinks (more) none, yet recent stores (more) recent comments echo earlZstrainYat|tr ZY @. |
|
earl.strain.at • esa3 • online for 8692 days • c'est un vanilla site |