Skip to content
This repository was archived by the owner on Mar 17, 2018. It is now read-only.
This repository was archived by the owner on Mar 17, 2018. It is now read-only.

Go packages (rclone and syncthing) on older MIPS kernel #860

@alllexx88

Description

@alllexx88

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 from gcc-7.2.0 toolchain
  • static host gcc-7.2.0 with go (gccgo and gotools). I do a little patching to build gotools (add -lpthread link flag) and use a gccgo wrapper that invokes $0.real "$@" -lpthread, since (static) libgo uses symbols from libpthread, and compiling Go code fails without the flag (I use host gccgo to bootstrap Go)

And this is how I build rclone and syncthing:

  1. Build and install .../vendor/golang.org/x/sys/unix with ordinary Go with -compiler gccgo switch: using go from gcc gotools skips building gccgo_c.c, which leads to multiple undefined references to gccgoRealSyscall
  2. Then build the rest with go from gcc 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions