rust-mobile/android-rs-glue

Common problems with linking with static c++ libs

katyo opened this issue · 1 comments

katyo commented

I developed bindings to c++ library, which widely uses global variables, which requires runtime initialization/finalization.
The library builds using clang++ from android NDK.

I have many linking errors like an error: undefined reference to '__dso_handle' when I build application.

I'm sure that this is common problem, but I still cannot find appropriate workaround, which can help solve this.

I guess that linker itself should use appropriate crt*.o module to deal around it but I don't know details why this is not so.

katyo commented

Currently I know only one way to avoid this issue: dynamic linking between C++ object and rust app. But in this case I cannot simply publish it on a crates.io