Failed compile on Android using Golang

I followed the instructions here but I got the following error when compiling rclone on a rooted android phone.

$ go get -u -v
go/src/ fatal error: ‘spawn.h’ file not found

Interestingly, the pre-compiled linux-arm binary works when the hotspot is activated. I was hoping to use rclone over wifi though so I’m trying to resolve this issue by compiling rclone for my specific device.

what exactly are you doing?
what are you changing to compile it for your device?

You will either need to

export CGO_ENABLED=0

Or install libfuse-dev

I haven’t quite decided whether this is going to be a permanent thing so it hasn’t made it to the instructions yet.

1 Like

Thanks, the export did the trick. I’m still getting connection refused using the resulting binary. If I switch the hotspot on, it just works. It seems to be a DNS issue as it can’t resolve the domains

I don’t know why that is alas.

I suspect compiling it with the android runtime might help. Try this build which I build with xgo. The 64 bit arm build didn’t work for some reason - hopefully the 32 bit one will work for you!