Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Android builds to CI #271

realcr opened this issue Mar 6, 2020 · 0 comments

Add Android builds to CI #271

realcr opened this issue Mar 6, 2020 · 0 comments


Copy link

@realcr realcr commented Mar 6, 2020

Offst's stcompact binary is designed to work on mobile devices, specifically on Android.

We want to compile it for the following architectures:

  • aarch64-linux-android
  • armv7-linux-androideabi
  • i686-linux-android

More specifically, we want the CI to compile for those architectures during testing, and create a release binary when a new version tag is pushed to this repository.

Currently the automatic CI build system compiles and tests Offset for Windows, linux and macos.
Building for the Android architectures mentioned above is probably a bit different, because cross compilation is required.

I managed to perform cross compilation successfully on my machine (Ubuntu 18.04) by following the instructions from mozilla's website, with some minor modifications:

  • Install android sdk
  • Install ndk
  • export NDK="/home/real/Android/Sdk/ndk/20.1.5948944"
  • Add symbolic link: ln -s $NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang $NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-clang. Should add a similar symbolic link for the other two architectures.
  • Add $NDK/toolchains/llvm/prebuilt/linux-x86_64/bin to $PATH environment
  • Create ~/.cargo/config, containing:
ar = "/home/real/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar"
linker = "/home/real/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-clang"

ar = "/home/real/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-android26-ar"
linker = "/home/real/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/arm-linux-android26-clang"

ar = "/home/real/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android26-ar"
linker = "/home/real/Android/Sdk/ndk/20.1.5948944/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android26-clang"
  • Finally, create a release using cargo build --target aarch64-linux-android --release

I need some help with making this work on the travis CI. My current gap in knowledge is how to install the android SDK and the NDK on the travis CI. Alternatively, maybe travis CI has special support for this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.