Hacker News new | comments | show | ask | jobs | submit login
Testing Go on the Raspberry Pi running FreeBSD (cheney.net)
45 points by kristianp 1573 days ago | hide | past | web | 8 comments | favorite



For those thinking about using Go on a Pi, I cannot overreccomend using cross compilation. It is incredibly easy and pleasant with go.


I do a lot of Go development on lots of ARM boards and I find that on the Raspberry Pi (the 512M model anyway) the Go compiler is quick enough on the actual device that there's not much point to cross-compiling, at least if you're running Raspbian/Linux (based on Dave Cheney's post here it sounds like things aren't quite as nice in FreeBSD due to various kernel issues).

On my old chumby boards, though, which are hamstrung for memory, I do cross-compile (in Windows!) and then rsync the resulting binary over, which is a much quicker turn around than compiling on the device and yes, the cross-compile system in Go is absolutely delightful compared to C/C++ toolchain hell.


For me cross-compiling for the Pi is mostly a matter not wanting to bother keeping my development setup on my regular laptop and my Pi in sync. I have a makefile now that go-installs' an x86 build on my laptop, scp's an arm build to my Pi, and builds/verifies a couple of datafiles. So basically I can press F9 on my laptop and have updated binaries on my laptop and Pi in about a second.

I could just ssh into the Pi and build there, but it would actually be more of a hassle than cross compiling; an impressive feat.


Can you tell us how to cross-compile for the pi? I remember looking for it but not finding much...


Dave Cheney (whose blog post is the linked article here) has a good writeup on this here:

http://dave.cheney.net/2012/09/08/an-introduction-to-cross-c...

Basically cross-compiling in Go is as easy as setting a few environmental variables to describe which OS/arch you want to compile for, though you have to do some from-source building of the Go toolchain in order to get the different compilers for different arches.

But you should be building from source if targeting ARM anyway because the current full Go binary release has much worse ARM support than the current +tip branch of Go in Go's mercurial repo.


I see, thank you. That's what I was trying and couldn't get to work, probably because I was only trying half of it.


> At the moment performance is not great, even by Pi standards. The SDCard runs in 1bit 25mhz mode, and I believe the caches are disabled or set to write though

While I'm curious, this sounds like a bout of a bummer.

I think I'll wait a little bit longer ;)


Node.js also compiles/runs on the RPi without issue.

EDIT: On Raspbian, haven't tried with FreeBSD.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: