Relay server for custom builds of syncthing android

Hi,

I tried building the syncthing-android apk locally using the instructions given @ https://github.com/syncthing/syncthing-android. All steps worked well and I was able to run syncthing successfully on 2 of my android phones. Both were using mobile data, and hence were not on the same LAN. However, they were not able to connect using the relay server either. Relay works fine when both these phones had google-play-store installed Syncthing.

My questions are the following:

Q1. Is it correct to assume, the community relay cluster supports only official downloads of syncthing executables?

Q2. If yes, could you help me with the details of what is the authorisation mechanism used to ensure such behaviour? This is so that I can emulate the same in my personal relay service.

There is some hack on the official builds to make DNS work properly, which is required for relays and which you might be missing. I think.

There’s nothing on the relay servers themselves to lock them down to only official builds or anything like that.

The make_all.bash should apply the DNS patch. Did you use the script to build your version?

I used my local installation of go1.8, since the make-all.bash was failing in my macOS Sierra.

I had read about the dns fix required for android in go1.4, is it needed for 1.8 as well?

I had gone through the following:

It is, if it’s not using the android build target. Which it should. We’ve talked about this before, I’m not sure why the Android build is done using the linux target.

I am a little confused. I understood that something special needs to be done here with go, but I have an added complication that go1.4 does not compile with macOS Sierra 10.12. (Reference link to the github golang issue). And we are using go1.4 as a submodule in syncthing-andriod.

I will try downloading the source for go1.7 and performing the syncthing specific build steps for android. Will post the result here soon.

Also, is it possible to make this android arm syncthing executable available for download on syncthing.net, like you have for all other OS and architecture combinations?

You should use Go 1.8.1 and nothing else. There is no reason to use the older versions. Then there are two ways to build binaries for Android using Go. One is to say “this is a binary for android” and the other is to say “this is a binary for linux”. The downside of doing the latter is that it then requires patches and crap which should not be needed in the first case. Those are the ones you may need to apply. But there is no need to involve an older Go compiler at any point.

I did this a while ago to show that it’s simple to build for Android without patches and stuff:

It requires Linux, but you can actually install Docker on Mac if you like and do it there. Perhaps try that and report if it works.

We use go1.4 to bootstrap go1.8.1

1 Like

I tried following the above mentioned steps on a linux box. I have hit a roadblock with the following error when I run the following command

command: CGO_ENABLED=1 CC=/usr/local/android-24-arm/bin/arm-linux-androideabi-gcc \ go run build.go -goos android -goarch arm build

error cmd/syncthing/gui_statics.go:37: undefined: auto.Assets cmd/syncthing/gui_statics.go:44: undefined: auto.Assets exit status 2 exit status 1

I have read the following related post, but the steps mentioned are not working for me:

That’s odd[quote=“AudriusButkevicius, post:9, topic:9750, full:true”] We use go1.4 to bootstrap go1.8.1 [/quote]

There’s no need to do this though, in general (I know there is a thing with some build host not allowing binaries to begin with). Go 1.8 can be bootstrapped by Go 1.8 just fine.

That’s odd, but try a go run build.go without other parameters or environment variables first to make it generate the auto files. Then retry.

You are right, it was odd. I had git cloned syncthing in some other folder ($GOPATH/src/a/b). The build worked when I placed the project root @ $GOPATH/src/github.com/syncthing/syncthing.

The syncthing executable generated for arm was of 16MB. I used it in syncthing-android and voila, it connected to one of the relay servers.

Thanks for your help @calmh.

Yeah, it needs to be in the magic place. That’s Go for you. But that’s great, you might be the first in a long time to try a real android-targeted binary. Let us know if you run into any unusual weirdness.

1 Like

Yes the process we use to build the Syncthing binary for Android is less than ideal. I tried to get it working with android-go some time ago, but didnt manage that. @samarth if you got this working, please make a PR :slight_smile:

Also, the build script should automatically use your installed Go 1.8, but there might be a bug somewhere.

Definitely will create a PR. I was able to connect 2 android phones via relay, however they are not exchanging data. I can say they connected because I see a green “Up to date” on the devices UI. Also, there is a successful joined relay log, that was missing in earlier so. Data not exchanging is almost certainly a problem with one of the phone’s (Samsung’s) OS misbehaving, since, they did not exchange any data even after connecting them via LAN (same wifi router).

Will test it out with other handsets that usually work (non-samsung) first and then raise a PR.

2 Likes

Hi Felix,

I have raised a PR @ https://github.com/syncthing/syncthing-android/pull/892

1 Like