Skip to content

fix(bindings): name the NDK C compiler for Android release builds - #440

Merged
bahdotsh merged 1 commit into
mainfrom
fix/release-android-c-compiler
Sep 12, 2026
Merged

bahdotsh merged 1 commit into
mainfrom
fix/release-android-c-compiler

Conversation

@bahdotsh

Copy link
Copy Markdown
Member

What broke

The v0.26.0 Release & Publish run (34696833375) failed in all four Build Android jobs, in ring's build script:

error occurred in cc-rs: failed to find tool "aarch64-linux-android-clang": No such file or directory

Nothing published: both release and publish-crates depend on build-android.

Why

0.26.0 added ring to the mobile cdylib via the telemetry uploader (ureq -> rustls). It is the first dependency in the Android build that compiles C, and it does so through cc-rs, which never reads cargo's linker setting. The workflow set only the linker and AR. cc-rs probes PATH for a versioned clang and then <triple>-clang; setup-ndk puts the NDK root on PATH, not the toolchain bin, so every ABI came up empty.

build-uniffi-android.sh has the same gap. It does put the toolchain on PATH, so cc-rs's fallback list finds aarch64-linux-android21-clang and x86_64-linux-android21-clang, but the list names armv7a-linux-androideabi16-clang and i686-linux-android16-clang, API levels NDK r24+ no longer ship, so the 32-bit ABIs fail locally too.

Fix

Both paths export CC_<triple> and CXX_<triple> pointing at the same versioned clang the linker uses. The workflow derives the variable name from the matrix target, so no new matrix fields.

Verification

Local, NDK r27, the locked cc 1.2.43:

  • ring alone under the exact CI env (linker + AR, toolchain off PATH): fails with the CI error. With CC_aarch64_linux_android set: builds.
  • ring alone under the script's env (toolchain on PATH) for armv7: fails with arm-linux-androideabi-clang not found. With CC_armv7_linux_androideabi set: builds.
  • Full cargo build --release --locked --target armv7-linux-androideabi -p offline-protocol-uniffi: builds, and check-elf-alignment.py reports 16 KB PT_LOAD alignment.

A workflow_dispatch dry run of the release workflow on this branch (version 0.26.0) is the CI-side proof; link in the comments.

After merge

Per the version-gate note and CONTRIBUTING, the tag can be deleted and re-pushed because nothing shipped:

git tag -d v0.26.0
git push origin :refs/tags/v0.26.0
git tag v0.26.0 <merge commit>
git push origin v0.26.0

0.26.0 added `ring` to the mobile cdylib through the telemetry uploader
(`ureq` -> `rustls`). ring compiles C and assembly with cc-rs, which does
not read cargo's linker setting and resolves a compiler on its own. All
four Android jobs of the v0.26.0 release run failed in ring's build
script with `failed to find tool "aarch64-linux-android-clang"`: the
release workflow set the linker and AR only, and setup-ndk puts the NDK
root on PATH rather than the toolchain bin, so cc-rs's probe found
nothing on any ABI. Its fallback list would not have saved the 32-bit
ABIs anyway: it names the API-16 clangs, which NDK r24 and later do not
ship, which is also why `build-uniffi-android.sh` (toolchain on PATH)
built arm64 and x86_64 but not armeabi-v7a or x86.

Both paths now export CC_<triple> and CXX_<triple> pointing at the same
versioned clang the linker uses.

Verified locally against NDK r27 with the locked cc 1.2.43: ring alone
fails under the exact CI env and under the script's env for armv7, and
builds under both once CC is set; the full uniffi cdylib builds for
armv7-linux-androideabi and passes the 16 KB alignment check.
@bahdotsh
bahdotsh merged commit 984fb2c into main Sep 12, 2026
39 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant