rust-mobile / android-rs-glue

Glue between Rust and Android
Apache License 2.0
906 stars 112 forks source link

Including additional dynamic libraries #174

Open torkleyy opened 6 years ago

torkleyy commented 6 years ago

I'd like to include .so files for the vulkan validation layers (e.g. libVkLayer_core_validation.so) in my APK. How can I do that?

hansihe commented 4 years ago

I also need to do something like this. As I understand it, there was some support for this before, but that seems to have been removed?

I am sure I can cobble something together and make a PR, but if anyone more familiar with the project has a preferred way to implement this in mind, any comments would be greatly appreciated.

katyo commented 4 years ago

I have same issue with bindings which depends from bundled shared object. Currently only libc++_shared.so can be packaged automatically when it used.

katyo commented 4 years ago

I think the optimal way to list all required shared objects (for packaging it together) using readelf, like the following: https://github.com/rust-windowing/android-rs-glue/blob/096c6dd62dfa3e6c233f9ed3aafedfb9dab57871/cargo-apk/src/ops/build/compile.rs#L332-L353 Of course, we should read shared objects recursively and filter out android libraries (like libandroid.so, liblog.so, etc.) I still don't find out how to get all libraries search paths from cargo. The libraries search paths can be simply extracted from rustc args.

katyo commented 4 years ago

@torkleyy Can you test cargo-apk from my PR above? Or let me do it.