From 83528c068af52a2ccf4c156974982956fcda1c57 Mon Sep 17 00:00:00 2001 From: Duncan Tourolle Date: Sat, 22 Aug 2026 21:19:46 +0200 Subject: [PATCH] Check the API level of an object a linker actually produced MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The step built `-p dr-gpu` and then looked for a `*.so` to read the API level out of with `file`. dr-gpu declares no `crate-type`, so it produces an rlib — an archive of object files no linker has touched, and about which `file` has nothing to say. The step could therefore only ever reach its own "no aarch64 .so was produced" branch, whatever the linker did, which is the one thing it exists to rule out. Builds `darkroom-android` instead: the workspace's only `crate-type = ["cdylib"]`, and the artefact that ships in the APK. The API level verified is now the one a device will refuse to install against. The neighbouring comment claiming only core crates cross-compile is left alone until the build proves otherwise; it is either stale or this commit is wrong, and the same run answers both. Co-Authored-By: Claude Opus 5 (1M context) --- .gitea/workflows/build-and-test.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build-and-test.yml b/.gitea/workflows/build-and-test.yml index cf6cb29..467fa17 100644 --- a/.gitea/workflows/build-and-test.yml +++ b/.gitea/workflows/build-and-test.yml @@ -117,7 +117,18 @@ jobs: CARGO_TARGET_DIR: target-android run: | set -e - cargo ndk -t arm64-v8a build -p dr-gpu --release + # `darkroom-android`, not a core crate: this step reads the API level + # out of a *linked* object, and only that crate produces one. It is + # the workspace's single `crate-type = ["cdylib"]`; a library crate + # builds an rlib, which is an archive of object files that no linker + # has yet touched and that `file` therefore has nothing to say about. + # Asking for `-p dr-gpu` here could only ever reach the "no aarch64 + # .so was produced" branch below, whatever the linker did. + # + # It is also the honest artefact to check: the .so this names is the + # one that ships in the APK, so the API level verified here is the + # API level a device will refuse to install against. + cargo ndk -t arm64-v8a build -p darkroom-android --release MIN_API=$(sed -n 's/^ARG MIN_API=\([0-9]*\).*/\1/p' docker/android/Dockerfile) # Empty on both sides would compare equal and pass, so neither side # is allowed to be the result of a failed parse.