Home » Android » android – What changed in rust_begin_unwind from Rust 1.11 to 1.12?

android – What changed in rust_begin_unwind from Rust 1.11 to 1.12?

Posted by: admin May 14, 2020 Leave a comment

Questions:

During the 1.12 beta, I built and ran code this for Android without problems:

[package]
name = "android"
version = "0.1.0"
authors = ["Author <[email protected]>"]
build = "build.rs"

[lib]
name = "mylib"
crate-type = ["cdylib"]

I use rustup and rustup target add arm-linux-androideabi.

Now when I load my Rust 1.12 library from Java code I get:

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol “rust_begin_unwind”

To temporarily fix this, I need a workaround:

#[allow(unused_variables)]
#[no_mangle]
pub extern
fn rust_begin_unwind(fmt: ::std::fmt::Arguments, file: &'static str, line: u32) -> ! {
    loop {}
}
  1. Why did unwinding become unavailable on the Android platform?
  2. How to fix this properly? When debugging, I want to see the full stack trace
    in the Android IDE log window.
How to&Answers: