Skip to content

Instantly share code, notes, and snippets.

@calmh
Last active April 1, 2017 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calmh/20c24afc283656695b76f7822c8c8997 to your computer and use it in GitHub Desktop.
Save calmh/20c24afc283656695b76f7822c8c8997 to your computer and use it in GitHub Desktop.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment