-
Notifications
You must be signed in to change notification settings - Fork 149
Go packages (rclone and syncthing) on older MIPS kernel #860
Description
Hi, seeing some closed issues (at least #857), I understand you're already aware of the problem. MIPS TomatoUSB, for example, is running a 2.6.22.19
kernel, which is apparently too old for current Go. e.g., running Entware-ng syncthing
produces this error:
[root@unknown opt]$ syncthing
[monitor] 12:56:24 FATAL: stderr: pipe: function not implemented
and trying to list files using rclone
gives this:
[root@unknown opt]$ rclone ls dropbox:
2018/01/23 12:47:55 ERROR : : error listing: Post https://api.dropboxapi.com/2/files/list_folder: dial tcp: lookup api.dropboxapi.com on 127.0.0.1:53: dial udp 127.0.0.1:53: errno -9
2018/01/23 12:47:55 Failed to ls: Post https://api.dropboxapi.com/2/files/list_folder: dial tcp: lookup api.dropboxapi.com on 127.0.0.1:53: dial udp 127.0.0.1:53: errno -9
The pipe error has a workaround on Optware-ng: see mips_no_pipe2.patch at https://github.com/Optware/Optware-ng/tree/master/sources/golang
The net.Listen
error (rclone
error from above) is trickier, I don't know of a workaround for it yet (see golang/go#23446).
Now, the (maybe) interesting part.
Optware-ng syncthing
and rclone
MIPS packages are built using gccgo
: though it's a bit hacky to achieve, the resulting packages work fine on 2.6.22.19
kernel. In case you're interested in details, I'm using the following for this:
- ordinary Go (
1.10beta2
in my case, for MIPS softfloat support) - cross
gccgo
fromgcc-7.2.0
toolchain - static host
gcc-7.2.0
withgo
(gccgo
and gotools). I do a little patching to build gotools (add-lpthread
link flag) and use agccgo
wrapper that invokes$0.real "$@" -lpthread
, since (static)libgo
uses symbols fromlibpthread
, and compiling Go code fails without the flag (I use hostgccgo
to bootstrap Go)
And this is how I build rclone
and syncthing
:
- Build and install
.../vendor/golang.org/x/sys/unix
with ordinary Go with-compiler gccgo
switch: usinggo
fromgcc
gotools skips buildinggccgo_c.c
, which leads to multiple undefined references togccgoRealSyscall
- Then build the rest with
go
fromgcc
gotools
(With syncthing
I'm patching build.go
for this)
See rclone.mk and syncthing.mk for the reference.
What do you think about this?