Step D (hello.c + getauxval_fix.c) launches cleanly. E.minus-1 (hello.c + getauxval_fix.c + cpp_smoke.c) crashes. All three are plain-C trivial single-function files. Theory: the regression is triggered by having 3 or more cc::Build static libs in a Tauri Android cdylib, regardless of what the libs contain. Test: clone hello.c as hello2.c (same content, different symbol) and add a third cc::Build step compiling it. If this crashes, the trigger is just the number of static libs. If it launches, there's something magical about cpp_smoke.c specifically (unlikely — it was near-identical content). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
48 lines
2.0 KiB
Rust
48 lines
2.0 KiB
Rust
use std::process::Command;
|
|
|
|
fn main() {
|
|
// ─── Embedded git hash ─────────────────────────────────────────────────
|
|
let git_hash = Command::new("git")
|
|
.args(["rev-parse", "--short", "HEAD"])
|
|
.output()
|
|
.ok()
|
|
.filter(|o| o.status.success())
|
|
.and_then(|o| String::from_utf8(o.stdout).ok())
|
|
.map(|s| s.trim().to_string())
|
|
.unwrap_or_else(|| "unknown".into());
|
|
|
|
println!("cargo:rustc-env=WZP_GIT_HASH={git_hash}");
|
|
println!("cargo:rerun-if-changed=../../.git/HEAD");
|
|
println!("cargo:rerun-if-changed=../../.git/refs/heads");
|
|
|
|
// ─── Step A: single trivial cpp/hello.c compiled via cc::Build ─────────
|
|
// ─── Step D: also compile getauxval_fix.c (legacy wzp-android shim) ────
|
|
// getauxval_fix.c overrides the broken static getauxval stub that
|
|
// compiler-rt pulls in for Android targets. It's been shipping in the
|
|
// legacy wzp-android .so for months without issue, so including it here
|
|
// is low-risk — but it's an incremental variable we want to isolate.
|
|
let target = std::env::var("TARGET").unwrap_or_default();
|
|
if target.contains("android") {
|
|
println!("cargo:rerun-if-changed=cpp/hello.c");
|
|
cc::Build::new()
|
|
.file("cpp/hello.c")
|
|
.compile("wzp_hello");
|
|
|
|
println!("cargo:rerun-if-changed=cpp/getauxval_fix.c");
|
|
cc::Build::new()
|
|
.file("cpp/getauxval_fix.c")
|
|
.compile("getauxval_fix");
|
|
|
|
// Step D+1: identical-content clone of hello.c as a third cc::Build
|
|
// static library. Tests the "any 3rd static lib triggers the crash"
|
|
// theory in isolation — no C++, no external deps, same C content as
|
|
// the known-working hello.c.
|
|
println!("cargo:rerun-if-changed=cpp/hello2.c");
|
|
cc::Build::new()
|
|
.file("cpp/hello2.c")
|
|
.compile("wzp_hello2");
|
|
}
|
|
|
|
tauri_build::build()
|
|
}
|