iotivity / iotivity-lite

To contribute code to the project, please visit
https://iotivity.org/get-involved
Apache License 2.0
126 stars 67 forks source link

java.lang.UnsatisfiedLinkError: dlopen failed #312

Closed Askidea closed 2 months ago

Askidea commented 2 years ago

The iotivity Android library was built in the branch 'master', commit '9c8ea1a' environment. And when I apply it to the app, build and run it, the following error occurs. The app repeatedly closes and restarts indefinitely.

< Logcat > 2022-09-13 12:30:06.401 15305-15305/org.iotivity.multideviceserver W/System.err: Native code library failed to load. 2022-09-13 12:30:06.401 15305-15305/org.iotivity.multideviceserver W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "oc_tcp_connection_state" referenced by "/data/app/org.iotivity.multideviceserver-1/base.apk!/lib/armeabi/libiotivity-lite-jni.so"... 2022-09-13 12:30:06.403 15305-15305/org.iotivity.multideviceserver I/art: System.exit called, status: 1

< build options : all flags TRUE, Ubuntu 20.04.4 LTS > iotivity-lite/port/android$ make NDK_HOME=~/toolchains/ndk18-android-arm-23 ANDROID_API=23 DEBUG=1 CLOUD=1 SECURE=1 IPV4=1 TCP=1 PKI=1 DYNAMIC=1 JAVA=1 IDD=1 OSCORE=1 MNT=1

Is there something wrong with the build or run environment?

Danielius1922 commented 2 years ago

Hello @Askidea,

Is there something wrong with the build or run environment?

oc_tcp_connection_state is a new function I've added last week. The Android job is broken, so that's probably the reason why we didn't catch this. I'll fix it.

BTW: You seem to have a working Android environment, could I perhaps ask you for a little help with this? I've updated the Android build - https://github.com/iotivity/iotivity-lite/pull/293/files, but I don't have an Android device and I wasn't able to make an emulator work. The build itself succeeds, but I wanted to test a simple application that uses libiotivity-lite-jni.so and run it on Android before merging it. Could you checkout the branch, use it in your App and check if it runs?

Askidea commented 2 years ago

Hi @Danielius1922, Thank you for your reply.

I think I can help you with what you said. I will test your branch and share the results. However, please understand that we may not be able to share it immediately due to the time difference or my work schedule.

Danielius1922 commented 2 years ago

@Askidea: Thank you!

I've updated it and now it also should fix the oc_tcp_connection_state linker error.

Askidea commented 2 years ago

@Danielius1922 branch "adam/feature/fix-android-job" port/android$ make NDK_HOME=~/toolchains/ndk18-android-arm-23 ANDROID_API=23 DEBUG=1 CLOUD=1 SECURE=1 IPV4=1 TCP=1 PKI=1 DYNAMIC=1 JAVA=1

Following error:

2022-09-19 12:06:17.458 19906-19906/net.askidea.sm.ocfclient W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "cls_ArrayList" referenced by "/data/app/net.askidea.sm.ocfclient-oo5PAa9yrKiC47uBZf8KZw==/base.apk!/lib/armeabi/libiotivity-lite-jni.so"

Danielius1922 commented 2 years ago

@Askidea Updated the branch again, hopefully no missing symbols anymore. (Sorry about this, but I have nobody else to test this but you.)

Askidea commented 2 years ago

@Danielius1922 Thank you for your contribution.

(1) branch : "adam/feature/fix-android-job", commit [286c87d]

(2-1) build options #1 : Android app running OK! iotivity-lite/port/android$ make NDK_HOME=~/toolchains/ndk25-android-arm-23 ANDROID_API=23 DEBUG=1 SECURE=1 IPV4=1 TCP=0 PKI=1 DYNAMIC=1 CLOUD=0 JAVA=1 IDD=1

(2-2) build options #2 : error as follows iotivity-lite/port/android$ make NDK_HOME=~/toolchains/ndk25-android-arm-23 ANDROID_API=23 DEBUG=1 SECURE=1 IPV4=1 TCP=0 PKI=1 DYNAMIC=1 CLOUD=0 JAVA=1 IDD=1

######## Error : 2022-09-19 18:39:55.367 28054-28054/? W/System.err: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "oc_cloud_manager_restart" referenced by "/data/app/net.quber.sm.ocfclient-Se5EkKSexJMbcAPIunhgCA==/base.apk!/lib/armeabi/libiotivity-lite-jni.so"

Danielius1922 commented 2 years ago

@Askidea Updated the branch again. Thank you for your help again!

Askidea commented 2 years ago

@Danielius1922 Thanks, branch : "adam/feature/fix-android-job", commit [8ee5236] build option : CLOUD=0 TCP=0 ==> OCF Client app runs without errors.

Additionally, I'm also doing a conformance test with CTT 2103.0.0, and the following items are FAILED for the attached PICS file. PICS_Askidea_cloud_0_tcp_0.zip

Network interface was selected as IPv6.

It would be nice if you could review these failed items as well. And the issue of CTT results for each version of the iotivity-lite library will be discussed as a separate issue.

Danielius1922 commented 2 years ago

@Askidea Nice, I can merge it then and at least fix the android Github job, so thank you for your help!

Regarding CTT stuff, I'm not sure I can help you with that, I do not know the internals of the CTT tools. My experience is limited to debugging failing test cases for Linux port. I do not know the interaction between the PICS file, compile configuration and simulator binary. Perhaps the failing test cases should not run for your setup. Or it might be a bug in the Android port. I do not know. @SiMet is the one who usually answers my questions regarding CTT, so perhaps he'll be able to tell us what this means.

Danielius1922 commented 1 year ago

@Askidea Have you tried running CTT with your setup and latest release? I'm wondering if the issues still occur.

Danielius1922 commented 2 months ago

No response, reopen or start a new issue if this is still a problem with the latest master.