Files
wz-phone/desktop/src-tauri/cpp/cpp_smoke.cpp
Siavash Sameni c9cd043657
Some checks failed
Mirror to GitHub / mirror (push) Failing after 1m26s
Build Release Binaries / build-amd64 (push) Failing after 3m37s
test: tauri.conf.json bundle.android.minSdkVersion=26 + cpp_smoke.cpp c++_shared
User theory: tauri-cli hardcodes minSdkVersion=24 into its rustc
invocation regardless of gradle build.gradle.kts, .cargo/config.toml,
or env var overrides — but DOES read from tauri.conf.json's
bundle.android block. That would explain why every cc::Build C++
compile crashed with __init_tcb+4 via pthread_create: API-24 bionic's
.init_array routines for the linked-in .init_array clash with the
pthread_create state tao later expects.

This commit applies the fix AND re-adds the smallest known crashing
variant (E.1 with cpp_link_stdlib('c++_shared')) so the test has one
clear failure mode to compare against:

  tauri.conf.json bundle:
    "android": { "minSdkVersion": 26 }

  build.rs (on android target):
    - hello.c           (plain C, worked in Step A)
    - getauxval_fix.c   (plain C, worked in Step D)
    - hello2.c          (plain C, worked in Step D+1)
    - cpp_smoke.cpp     (C++ via cc::Build .cpp(true), crashed in E.1)

Also re-emits the libc++_shared.so copy into gen/android jniLibs so
the runtime linker can resolve the NEEDED entry cc-rs added via
cpp_link_stdlib('c++_shared').

If this launches → theory validated, proceed with Oboe integration.
If this crashes → need to keep digging.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 16:58:37 +04:00

10 lines
391 B
C++

// cpp_smoke.cpp — original Step E.1 minimal crashing C++ file.
// Compiled with cc::Build::new().cpp(true).cpp_link_stdlib("c++_shared").
// Never called from Rust (dead-stripped at link time). Used to validate
// the tauri.conf.json minSdkVersion=26 fix against the smallest variant
// that was reliably crashing with __init_tcb+4.
extern "C" int wzp_cpp_hello(void) {
return 42;
}