From 903a07c1d41c9ba96b0f0007717be4abe787f1fb Mon Sep 17 00:00:00 2001 From: Siavash Sameni Date: Thu, 9 Apr 2026 12:55:11 +0400 Subject: [PATCH] fix(android): force API-26 NDK linker via docker env vars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous commit bumped minSdk from 24 to 26 in build.gradle.kts hoping tauri-cli would pick it up and use the android26-clang linker, but the crash recurred at exactly the same frame (__init_tcb via pthread_create via std::thread::spawn). That means tauri-cli is ignoring the gradle minSdk value and sticking with its hardcoded aarch64-linux-android24-clang. The android24 linker resolves __init_tcb against the broken static stub in libc.a (API 24 does NOT export __init_tcb as a dynamic symbol from libc.so — it only exists in the static archive, and the stub expects the TCB to be initialised by a running static init path, which never happens in a dlopen-loaded .so). Override the linker env vars directly in the docker run invocation for all four ABIs. These take precedence over anything tauri-cli or .cargo/config.toml might set. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/build-tauri-android.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/build-tauri-android.sh b/scripts/build-tauri-android.sh index 8e82a7a..7956466 100755 --- a/scripts/build-tauri-android.sh +++ b/scripts/build-tauri-android.sh @@ -153,6 +153,10 @@ docker run --rm \ --user 1000:1000 \ -e DO_INIT="$DO_INIT" \ -e PROFILE_FLAG="$PROFILE_FLAG" \ + -e CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang \ + -e CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi26-clang \ + -e CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang \ + -e CARGO_TARGET_I686_LINUX_ANDROID_LINKER=/opt/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android26-clang \ -v "$BASE_DIR/data/source:/build/source" \ -v "$BASE_DIR/data/cache/cargo-registry:/home/builder/.cargo/registry" \ -v "$BASE_DIR/data/cache/cargo-git:/home/builder/.cargo/git" \