4

I installed golang via (on RPi3, Raspbian Stretch)

sudo apt install golang

Currently go version reports

go version go1.7.4 linux/arm

I successfully compiled and ran some go program that toggles GPIO using "go-rpio" library.

The question is can I copy/move the resulting binary program to RPI2,1, as well other Raspbian distribution (such as Jessie).

How portable is the binary generated by golang?

1

"How portable is the binary generated by golang?": It depends

  • a) on your build process, which CPU Architecture

  • b) additional Package Dependencies

    (For example, CGO_ENABLED=1 possible ? In my example it wasn`t, cause my Golang Binary got C Dependencies as well)

Generally building a golang binary and run it on other distribution "out of the box" is not 100% right. There could be always some "hidden" Dependencies which prevents your binary to be "static" , even if you`re trying to import it to another Distribution.

Additional Link to "Static Golang Binaries: https://medium.com/@diogok/on-golang-static-binaries-cross-compiling-and-plugins-1aed33499671

Hope I Could answer your Question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.