Closed lukasmalkmus closed 7 years ago
Same Issue
Set the appropriate environment variables before building.
Example:
export GOOS=linux
and
export GOARCH=arm
Then do a go install ./...
and look under your go/bin
directory. Remember that you're looking for a binary for another platform now -- it won't have an .exe extension. SCP the binary you find to your Raspberry Pi and you should be good to go.
Oh wow, this issue is old. This was in my early go days where I wasn't familiar with the go tooling. Reading my own issue a year later makes me feel a little bit embarrassed. Anyway, thanks for the reply. Might be useful many new go newbies :)
No worries. I remember being blown away by setting some environment variables and compiling for a different platform too. :smile:
What about cross platform compiling? The OS its going on is Linux and the Arch is arm but wanted to build on windows. Is that possible?
Absolutely. That's exactly what I do. I prefer to use the git 'bash' commandline window, but the concept is the same on windows: Set your GOOS
and GOARCH
environment variables and then run go install ./...
OS: Windows 10 Prof. 64 Go Version: 1.6
I tried to build a small sample program. It is designed for my Raspberry Pi. However, I failed very early when building was not possible. I face these errors when running
go build
:They only appear if I import the Raspberry Pi Drivers. Building without the rpi package is possible, but won't work obvisiously.