Starting from an Ubuntu installation or similar Docker image, install the NDK.
curl -s -o /tmp/android-ndk.zip https://dl.google.com/android/repository/android-ndk-r14b-linux-x86_64.zip
cd /usr/local
unzip /tmp/android-ndk.zip
rm -f /tmp/android-ndk.zip
Create the standalone stuff, whatever that is. Arm and arm64.
/usr/local/android-ndk-r14b/build/tools/make-standalone-toolchain.sh \
--platform=android-24 --arch=arm \
--install-dir=/usr/local/android-24-arm
/usr/local/android-ndk-r14b/build/tools/make-standalone-toolchain.sh \
--platform=android-24 --arch=arm64 \
--install-dir=/usr/local/android-24-arm64
Build Syncthing, arm and arm64. Requires just the stock Go 1.8 binary dist for Linux, no funny business or rebuilding required.
CGO_ENABLED=1 CC=/usr/local/android-24-arm/bin/arm-linux-androideabi-gcc \
go run build.go -goos android -goarch arm build
CGO_ENABLED=1 CC=/usr/local/android-24-arm64/bin/aarch64-linux-android-gcc \
go run build.go -goos android -goarch arm64 build
I didn't try 386 or amd64 but I guess that probably works if there are phones on it.