sonos / dinghy

Easier cross-compilation for phones and single boards computers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copies libdl.so to Android, causing failure to run

tom-bowles opened this issue · comments

Running tests or benches for my crate on Android gives me
CANNOT LINK EXECUTABLE "/data/local/tmp/dinghy/microscope-6f3350548eff39a3/_dinghy_microscope-6f3350548eff39a3": cannot locate symbol "android_get_application_target_sdk_version" referenced by "/apex/com.android.runtime/lib64/bionic/libc.so".... That's with API 26 - using API 30 gives me a segfault instead.

I can run the binary directly in adb shell without error, and I can reproduce the error by adding /data/local/tmp/dinghy/overlay/ to LD_LIBRARY_PATH as dinghy does. That folder contains only libdl.so and libdl.a.

I've been able to work around the problem by making is_banned in src/compiler.rs explicitly exclude libdl the same way it excludes libstdc++. Whether that's the right fix though, I don't know. Certainly, libdl is not your average .so - the android linker knows about it and redirects things that depend on it to call into the linker instead.

@fredszaq, @Deluvi do we have anything interesting to say about this ? :)

it looks like the thing to do indeed, could you do a pr with this change @tom-bowles ?

Apologies for the wait - raised pr #125