I'm trying to build a project A for Android using
cargo-apk. The project uses another crate B which wraps a C API for a C++ static library.
If I add the following to
.cargo/config for project A everything runs fine. Adding it to project B doesn't...
rustflags = ["-C", "link-arg=-lc++_static", "-C", "link-arg=-lc++abi"]
If instead I add the following to
build.rs in either project, I get runtime errors for missing cxxabi symbols.
... and the following a compile time link error...
As far as I can tell these lines should do the same thing, so I'm at a loss as to what the issue might be. Ideally I would like linking to work in crate B so that I know that distributing crate A won't cause the same linker issues for others. My best guess is it's a quirk of cargo-apk (relevant code?), but I'm not sure I'd know the issue if I saw it.
Aside: for the curious, A is bevy, B is a rewrite of glsl-to-spirv known to work on desktop.