feat(android): cross-build core libdb for aarch64-linux-android + CI gate - #115
Merged
Conversation
Add dist/android/build_android.sh: derives the NDK clang paths from
ANDROID_NDK_ROOT (as exported by setup-ndk / setup-android, with
ANDROID_NDK_HOME / NDK fallbacks and nixpkgs ndk-bundle nesting handled),
writes a meson cross-file, and drives the existing root meson.build to
produce build-android/libdb.so.
The NDK clang is just a cross-compiler: meson's HAVE_* probes are all
compile/link checks (which succeed when cross-compiling) and sizeof/
alignment resolve via compile-only probes, so no target execution and no
db_config.h hand-patching are required. The core C library cross-builds
clean against bionic with zero source changes.
Validated locally with nixpkgs ndk-bundle (NDK r29, API 24):
file build-android/libdb.so ->
ELF 64-bit LSB shared object, ARM aarch64, ... for Android 24
Also ignore the default build-android/ output dir.
Add .github/workflows/android.yml (schedule + workflow_dispatch + PRs touching src/**, meson.build, dist/android/**). Sets up the NDK via nttld/setup-ndk@v1 (r29), runs dist/android/build_android.sh, and asserts the artifact is an 'ELF 64-bit LSB shared object, ARM aarch64' -- the assert step is a real signal even though the job is continue-on-error (advisory tier; Android is not yet a release target). Uploads libdb.so as an artifact. Modeled on fuzz.yml / ci.yml structure and comment style.
Coccinelle convention checksNo new violations. ✅ Resolved since baseline (2) -- update dist/cocci/baseline.txt to lock these in. |
ABI diff vs
|
gburd
added a commit
that referenced
this pull request
Jul 31, 2026
feat(android): cross-build core libdb for aarch64-linux-android + CI gate
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.
Can libdb be built for Android? Yes — the core library cross-builds clean.
This adds a working Android cross-build path and a CI workflow that gates it.
Answer
.github/workflows/android.ymlcross-compiles the core Clibrary for
aarch64-linux-androidwith the NDK's clang and asserts theartifact is an ARM aarch64 ELF. No emulator/device needed — it's a cross-BUILD
test.
cross-compiler;
ANDROID_NDK_ROOT=/path/to/ndk dist/android/build_android.shworks on any Linux (or macOS) host. No EC2 launch required — the CI job is the
concrete deliverable; EC2 is the same command on a different box.
Approach (meson cross-file, not the stale Android.mk)
Rather than resurrect
build_android/Android.mk(frozen atdb-5.3.28, 2013,and it builds the SQL adapter), this cross-compiles the core libdb via the
existing root
meson.build:dist/android/build_android.shderives the NDK clang paths fromANDROID_NDK_ROOT(as exported bynttld/setup-ndk/android-actions/setup-android;ANDROID_NDK_HOME/NDKfallbacks; nixpkgsndk-bundlenesting handled),writes a meson cross-file, and runs
meson setup --cross-file … && ninja.HAVE_*probes are allcompile/link checks (which succeed cross) and
sizeof/alignmentresolve viacompile-only probes — so no target execution and no
db_config.hhand-patching are needed.
Portability gaps found: none
The core C library cross-builds clean against bionic with zero source
changes. Only the usual K&R-prototype
-Wdeprecated-non-prototypewarnings(same on any modern compiler against this old codebase); no errors, no bionic
vs glibc header/symbol breakage in the core sources. No
#if defined(__ANDROID__)guards were required.
Evidence (local build, nixpkgs ndk-bundle, NDK r29, API 24)
CI workflow
.github/workflows/android.yml:schedule(weekly) +workflow_dispatch+PRs touching
src/**/meson.build/dist/android/**. Sets up the NDK(
nttld/setup-ndk@v1, r29), runs the cross-build, and asserts the artifactis
ELF 64-bit LSB shared object, ARM aarch64(that assert step is a real redsignal). The job is
continue-on-error(advisory tier — Android is not yet arelease target) and uploads
libdb.soas an artifact. Modeled onfuzz.yml/ci.yml.Does not break the normal build
No source or
meson.buildchanges — only a new script + workflow + two.gitignorelines. Confirmed the native meson build still produces an x86-64libdb.so(no-op for the normal Linux build).Files
dist/android/build_android.sh— cross-build driver (meson cross-file).github/workflows/android.yml— CI gate.gitignore— ignorebuild-android/