3 ms·
> "Cross-compiling this for Raspberry Pi is a pain. ARM != ARM, there are several variants and when I tried to cross-compiling Prometheus with CGO, it just lead
by laumars 12y ago
> "Cross-compiling this for Raspberry Pi is a pain. ARM != ARM, there are several variants and when I tried to cross-compiling Prometheus with CGO, it just lead to segfaults or invalid instructions."
I'm pretty sure I had similar issues on the original model B and found I was missing specifying which ARM version it was:
export GOARCH="arm"
export GOARM="5"
I don't know if the same is required for the Raspberry Pi 2 nor even which ARM chipset version it is (the same I'm going to assume since Raspbian / Arch / etc still run) but it might be worth checking you have your GOARM environmental variable set
- simcop2387 12y agoThe PI2 should be much easier to get going with this since it's finally updated to ARMv7 and can actually run normal distros along with raspbian. I don't know what other extensions it has but i'd hope it'll work out of the box there.
- discordianfish 12y agoJust for completeness, my answer to the same Q on the blog: --- his doesn't solve cross compilation CGO. For that, you need the gcc cross compiler for the raspberry pi. I've tried to build it with CGO enabled like this: CC=arm-linux-gnueabihf-gcc GOARCH=arm CGO_ENABLED=1 go build -ldflags="-extld=$CC" But the binary still segfaulted on the raspberry pi. I also tried the cc from https://github.com/raspberrypi.. https://github.com/raspberrypi... but with the same result.
- laumars 12y agoAh ok. Shame. Thanks for the update though :)