Conversation
…paths Patch Boost.Asio to skip -lpthread on Android (pthreads are in bionic's libc), enabling all 9 RPC test targets to build and pass. Also fix hardcoded /tmp paths in bridge_test, client_test, and split_buffer_test to use /data/local/tmp on Android.
cc_library does not support the linkshared attribute. Switch to cc_binary (the correct rule for producing a .so) and add target_compatible_with to skip it on non-Android CI builds.
register_toolchains in MODULE.bazel causes Bazel to eagerly fetch the NDK repo on all builds, failing CI where ANDROID_NDK_HOME is unset. Move the registration to --extra_toolchains in .bazelrc so it only triggers when --config=android_arm64 (or x86_64) is active.
Cross-compile all test targets for Android x86_64 and run them on a hardware-accelerated emulator via reactivecircus/android-emulator-runner. Also complete the android_x86_64 bazelrc config with --cpu and linkopt flags matching the arm64 config.
The emulator-runner action executes script lines individually via sh -c, breaking multi-line if/fi blocks. Move the test logic to a proper bash script invoked as a single command.
- Add missing sources (split_buffer.cc, system_info.cc) to common/Android.bp - Add proper dependency declarations for coroutines, cpp_toolbelt, and abseil throughout all Android.bp files - Provide reference Android.bp files for external deps (coroutines, cpp_toolbelt) in external/ directory - Document AOSP/Soong build process in docs/android.md
Use API 30 google_apis image instead of API 28 default (more stable on CI runners). Increase boot timeout to 900s and add robust adb reconnection logic after root.
- Add SUBSPACE_ANDROID define when building with NDK toolchain
- Fix -lrt linking (Linux-only, not Android/macOS)
- Add -llog for Android targets
- Include pre-generated protobuf files for cross-compilation (avoids
needing a host-native protoc matching the library version)
- proto/CMakeLists.txt auto-detects cross-compilation and uses
pre-generated files or falls back to a host protoc
Usage:
cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-28 ..
Tests expect plugins at relative path plugins/*.so. Build plugins in the cross-compile step and push them to the correct location on the emulator.
Ensure build-dir includes take priority over source-dir so freshly generated proto files are always preferred in native builds. Document the CMake Android cross-compilation workflow.
Builds the project for Android arm64-v8a using the NDK toolchain file and the pre-generated protobuf files.
Build x86_64 binaries via CMake and run them on an Android emulator, matching what the Bazel android job does. Tests core subspace functionality (common, split_buffer, client, c_client, shadow).
The Cargo-based Rust build doesn't support cross-compilation via CMake's toolchain file. Skip it when CMAKE_CROSSCOMPILING is set.
Android's lld requires all symbols resolved at link time for shared libraries (--unresolved-symbols=ignore-all is not supported). Link plugins against their full dependency chain on Android.
Use path pattern */x86_64-linux-android/* instead of *x86_64* which was incorrectly matching the riscv64 library.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds android support to subspace