Additional build target? (MIPS without FPU)

I’d like to propose/suggest/request a new build-target for syncthing that targets MIPS without an FPU as tends to be common with router hardware.

In particular, I’m interested in getting the syncthing-relay-server running on LEDE/OpenWRT targeting the AR71xx (MIPS) build.

There is a known issue with these devices not having an FPU which leads to errors that look like this:-

$ ./strelaysrv: line 1: syntax error: unexpected "("

The root of the problem seems to be that the golang compiler normally builds a binary that uses instructions from the FPU set.

Two approaches for resolution seem to exist:-

We can set softfloat on the normal mips build we do. There is little enough floating point going on that the impact should be minimal on hardware that has an fpu.

Try this build:

Going by the build log it looks like only the mips build was affected, not mipsle nor the 64 bit variants. Perhaps that is expected (I would have expected the mipsle build at least to behave the same).

Have to admit I was being lazy when I posted this earlier since I’d not looked into building and checking it out for myself, perhaps scared off because I have limited golang experience.

After reading the syncthing build.go code I realized all that is required is to export an environment variable before compiling, aka

$ export GOMIPS=softfloat
$ go run build.go -goarch mips build strelaysrv

I also started by trying to build for mipsle which I discovered did not work on the target AR71xx based device I am using (TP-Link WR1043)

My initial startup of strelaysrv took about 8 minutes to generate the keypair

root@LEDE:~# ./strelaysrv 
2017/10/17 17:59:56 main.go:149: strelaysrv v0.14.49-rc.2+4-g6df3940c-dirty (go1.10.1 linux-mips) ndejong@chickens 2018-06-20 21:53:06 UTC
2017/10/17 17:59:56 main.go:155: Connection limit 3276
2017/10/17 17:59:56 main.go:168: Failed to load keypair. Generating one, this might take a while...
2017/10/17 18:07:35 main.go:244: URI: relay://

I tested the syncthing build you created (23021), however it turns out this little AR71xx device does not have enough memory to run it and blows up with this

root@LEDE:/tmp# ./syncthing 
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x778ca7, 0x16)
	/usr/local/go/src/runtime/panic.go:616 +0x80
runtime.sysMap(0xa600000, 0x1000000, 0x1067000, 0xcee4d8)

For the sake of the use case I’m chasing I’m okay with just being able to run strelaysrv

Thanks for the prompt response!


Anyway, our MIPS builds of everything (relaysrv included) are now softfloat. If that works better for someone, all good. These are not usually the machines selected for their performance anyway.

Isn’t key generation and crypto heavily reliant on fpu’s?

Not afaik, but I could be wrong. It should all be integer math.