Rebuilding Arti for Android
The four committed libarti_android.so files are built from the official Arti
source plus the JNI wrapper in this directory. The supported build path is the
pinned Linux container:
tools/arti-build/rebuild-in-container.sh
tools/arti-build/verify-checksums.sh
The container builds all four Android ABIs, verifies the exported JNI symbols
and rejects native binaries containing host-specific paths. It then rewrites
tools/arti-build/SHA256SUMS; both that manifest and the rebuilt libraries are
release inputs.
Pinned inputs
TOOLCHAIN.env: Arti tag and commit, stable build epoch, Rust,cargo-ndk, Android NDK, and immutable Debian snapshotrust-toolchain.toml: Rust release and Android targetsCargo.lock: complete Rust dependency graphDockerfile: digest-pinned Rust base image and checksum-verified NDK archiveCargo.tomlandsrc/lib.rs: JNI wrapper package and source
Rust source paths are remapped to stable virtual paths, incremental compilation
is disabled, and SOURCE_DATE_EPOCH is pinned to the value used for the
committed libraries.
Updating Arti or the native toolchain
-
Update the tag, full source commit, stable build epoch, tool versions, archive name, and archive checksum in
TOOLCHAIN.env. -
Update
Cargo.tomlif Arti changed its crate features or wrapper version. -
Regenerate
Cargo.lockagainst the exact Arti checkout and review every dependency change:tools/arti-build/rebuild-in-container.sh --update-lockfile -
Update the digest-pinned base image and
rust-toolchain.tomlwhen changing Rust. -
Run
tools/arti-build/rebuild-in-container.shtwice from clean generated state and confirmtools/arti-build/SHA256SUMSis unchanged. -
Run the Android tests and the two-build release comparison described in
docs/reproducible-builds.md.
Do not build release native libraries with an unpinned local NDK or Rust
toolchain. build-arti.sh deliberately rejects mismatched tool versions.
JNI surface
The wrapper exports the native methods used by ArtiNative:
getVersionsetLogCallbackinitializestartSocksProxystop
The build fails if any expected symbol is absent. The NDK readelf check also
reports ELF load-segment alignment for Android's 16 KiB page-size requirement.