iotivity-lite icon indicating copy to clipboard operation
iotivity-lite copied to clipboard

java.lang.UnsatisfiedLinkError: dlopen failed

Open Askidea opened this issue 2 years ago • 10 comments

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?

Askidea avatar Sep 13 '22 06:09 Askidea

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?

Danielius1922 avatar Sep 13 '22 08:09 Danielius1922

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.

Askidea avatar Sep 13 '22 10:09 Askidea

@Askidea: Thank you!

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

Danielius1922 avatar Sep 13 '22 10:09 Danielius1922

@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"

Askidea avatar Sep 19 '22 03:09 Askidea

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

Danielius1922 avatar Sep 19 '22 07:09 Danielius1922

@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"

Askidea avatar Sep 19 '22 11:09 Askidea

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

Danielius1922 avatar Sep 19 '22 16:09 Danielius1922

@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.

  • CT1.7.2.4 FAILED
  • CT1.7.8.2 FAILED (if all build options are true, this marked PASSED)
  • CT2.2.3 FAILED (oic.d.blind > oic.r.openlevel, /OpenLevelResURI, UPDATE operation failed for "openLevel" property. error excuting doPost() )

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.

Askidea avatar Sep 20 '22 11:09 Askidea

@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 avatar Sep 20 '22 14:09 Danielius1922

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

Danielius1922 avatar Sep 19 '23 16:09 Danielius1922