ci: add Android cross-compile workflow (aarch64, both backends) - #2474
Conversation
Adds aarch64-linux-android cross-compile smoke tests for both the Botan and OpenSSL backends, mirroring the OHOS workflow (#2438) but with key additions: - Tests the OpenSSL backend, which the OHOS workflow does not cover; this is where the CMAKE_DL_LIBS linkage gap (#2473) manifested - Sets CMAKE_CROSSCOMPILING_EMULATOR=qemu-aarch64-static so the findopensslfeatures probe actually runs under emulation, catching the '-static' + dlopen linkage class of bugs - Post-nlohmann (#2439): no json-c dependency to cross-build - No SDK geo-restriction (unlike OHOS): the NDK downloads freely The NDK toolchain file, qemu-user-static, and cacheable dependency builds keep the workflow simple. Each backend is a separate matrix leg so a failure in one doesn't mask the other.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2474 +/- ##
==========================================
- Coverage 85.46% 85.46% -0.01%
==========================================
Files 125 125
Lines 22964 22962 -2
==========================================
- Hits 19627 19625 -2
Misses 3337 3337 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The piped curl|tar failed on redirects: botan.randombit.net and openssl.org redirect to CDN URLs that don't stream cleanly through the pipe, leaving tar with an HTML error page instead of the archive.
The version strings are defined in the matrix include block, not as job-level environment variables; env.botan_version resolved to empty, making the download URLs 404.
FindBotan couldn't locate the cross-built library because the Android toolchain restricts find_library to the sysroot via CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY; adding the dependency prefix to CMAKE_FIND_ROOT_PATH lets it search there. OpenSSL 1.1.1's Configure expects the old-style NDK gcc wrapper names; exporting CC/AR/RANLIB pointing at the modern clang toolchain and prepending it to PATH makes the android-arm64 target find its compiler.
…figure Cross toolchain files (e.g. Android NDK) restrict find_path/find_library to the sysroot and CMAKE_FIND_ROOT_PATH, so the nested configure failed to rediscover the cross-built OpenSSL (missing OPENSSL_INCLUDE_DIR / OPENSSL_CRYPTO_LIBRARY) even when the parent find_package succeeded.
…nfigure The NDK toolchain file derives the target ABI and API level from these cache variables, not the environment; without them the nested configure silently built the probe for the default 32-bit ARM ABI and failed to link against the cross-built arm64 libcrypto.a.
|
@ni4 All checks are green now (only the fleet-wide known Two notes for review:
|
|
Merged with single approval as CI only. |
|
Follow-up note now that this has landed: this workflow exists thanks to @jolavillette's report and fix in #2473 (itself a follow-up to #2396, the original cross-compilation work by @G10h4ck). His Android NDK build failure showed we had no CI coverage for Android cross-compilation at all - so beyond merging his one-line @jolavillette - thank you for the careful report and the correct fix; Android is now a first-class CI platform for rnp because of it. If you hit anything else on the RetroShare Android toolchain side, please do report back. |
Summary
Adds
aarch64-linux-androidcross-compile smoke tests for both the Botan and OpenSSL backends, preventing the class of bug fixed in #2473 (missingCMAKE_DL_LIBSon Android cross-compile with static OpenSSL).Why both this and the existing OHOS workflow?
The
CMAKE_CROSSCOMPILING_EMULATORflag is the critical piece: it triggers the-staticbuild of thefindopensslfeaturesprobe and executes it under qemu, catching linkage gaps that a build-only check misses.What it catches
Without this workflow, the #2473 bug (static
libcrypto.a→dso_dlfcn.o→dlopenundefined on bare sysroots) was invisible to CI. With it:-static→ fails to link ifCMAKE_DL_LIBSis missingDesign
nttld/setup-ndk@v1(no geo-restriction)qemu-user-staticfrom Ubuntu repos (no manual setup)android.toolchain.cmakewithANDROID_ABI=arm64-v8a,ANDROID_PLATFORM=android-24CI-only change (new workflow file, no code changes).
Closes the CI coverage gap that allowed #2473 to reach users.