sonos / dinghy

Easier cross-compilation for phones and single boards computers
Other
365 stars 44 forks source link

copy libc++_shared.so for Android tests #197

Open ZhaoXiangXML opened 1 year ago

ZhaoXiangXML commented 1 year ago

My project has a C++ dependency and I'd like to run tests with dinghy.

But it has the following error:

library "libc++_shared.so" not found: needed by main executable

I noticed there was a PR says it's supported: https://github.com/sonos/dinghy/pull/103

But I don't know how to make it work, as far as I can tell, there's no way to modify the variable build.dynamic_libraries

fredszaq commented 1 year ago

Hi @ZhaoXiangXML

This is something that was indeed supported before the big refactoring of in #157. We do need to add that back (one solution would be to parse the binary with https://crates.io/crates/elf to get the linked libs (we were getting the info directly form cargo before but this is now complicated to get with the new approach... )

Note that if you are using run-with we should still get the dependent dylibs to the device. This means however you need to write a wrapper (can be quite simple) and it won't have the hability to run tests from the test harness...

ZhaoXiangXML commented 1 year ago

I've wrote a workaround in the build.rs of my project, that would run adb push libcxx_shared_in_ndk /data/local/tmp/dinghy/overlay/libc++_shared.so for Android, which solves my problem for now.

However I still hope this can be implemented in dinghy.