If you are trying to use Golang on a PC-Engines Alix board, you need to be careful that all the Go code you are using is compiled while the GO386 environment variable is set to 387. The Geode processor does not support the SSE instructions.
If you have Linux directly on the Alix, you’d not run into this because if GO386 is not set, then the compiler auto-detects the right thing. But if you are, for example, running OpenWRT on the device, and you are using cross-compilation to build on another device, you might run into this if some of your Go code (for example, the std lib) was compiled without GO386.
The symptom you’ve given yourself this problem is a traceback like this:
# ./sms.test
SIGILL: illegal instruction
PC=0x813db39
goroutine 1 [running, locked to thread]:
math.init·1()
/home/jra/go/src/math/pow10.go:34 +0x19 fp=0x1862df64 sp=0x1862df60
math.init()
The solution is that when you initialize cross compilation, you need to do it like this:
$ cd $HOME/go/src
$ GO386=387 GOARCH=386 ./make.bash --no-clean
And all of your compiles, like go test -c need to have the GO386 environment variable set as well, thus:
$ cd $GOROOT/src/github.com/jeffallen/linkio
$ GO386=387 GOARCH=386 go test -c
(If your code doesn’t use floating point, you might dodge a bullet if you forget to set GO386. But don’t say I didn’t warn you…)
Leave a Reply