dlopen failed: cannot find "libadsprpc.so"
Join Date: 14 Sep 17
Posts: 1
Posted: Thu, 2017-09-21 18:02
I am trying to build an android apk calling certain functions on the aDSP. I am able to get the calculator app running and also made another simple shell program calling four new API calls. I am using android studio to build the apk, I compiled the library file in the hexagon sdk environment with a java wrapper using swig.
BUILD_DLLS += libmylib
libmylib_QAICIDLS += inc/mylib
libmylib_C_SRCS += $V/mylib_stub src/mylib_wrapper
llibmylib_DLLS += $(LIB_DSPRPC)
I copy the mylib.so and libadsprpc.so to jniLibs/armeabi in android studio. It compiles but gives this error when I try to run the app.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sample.myapp, PID: 21994
java.lang.UnsatisfiedLinkError: dlopen failed: cannot find "libadsprpc.so" from verneed[0] in DT_NEEDED list for "/data/app/com.sample.myapp/lib/arm/libmylib.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:977)
at java.lang.System.loadLibrary(System.java:1567)
at com.sample.myapp.MainActivity.onCreate(MainActivity.java:15)
at android.app.Activity.performCreate(Activity.java:6912)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2877)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2985)
at android.app.ActivityThread.-wrap14(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1635)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6692)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
The mylib.so still works fine with my shell program.
Also, where do I have to store the libmylib_skel.so ?
Any clue what the issue is? I assume I am not saving something in the right location.
I have the same issue. Did you solve it ? I am trying to get the calculator example to run in an Android app with Android Studio.
In Android.mk I created two modules for the libcalculator_test.so and libcalculator.so:
Then I create a library that will try to call calculator_test() function inside libcalculator_test.so.
I load both libcalculator_test.so and libcalculator.so from my Java code:
At runtime I get the same error:
app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libcalculator.so
Native code library failed to load.
java.lang.UnsatisfiedLinkError: dlopen failed: library "libadsprpc.so" not found
Any help would be very appreciated !
Just figured it out. I was very close and not sure why I did not go the extra mile...
Just added any dependencies that dlopen complains about at runtime (in my case adsprpc and c++) in Android.mk:
And load them in Java:
I have the same problem with you, have you soloved this problem?
I also have a similar question. It seems that the libadsprpc.so and other ".so" builded by the Hexgon sdk have no "SONAME" segment in the ELF. But i don't know how to add this "SONAME" to the library.
arm-linux-androideabi-readelf -d libadsprpc.so sais:
Hi guillaume.poirier,
Looks like your Android.mk references a "libadsprpc.so" which is located in your project directory. But where did you get it in the first place? I cannot find it anywhere in SNPE SDK directory nor within system directories of the device. Or should I build it from some sources before loading?
You would help me a lot with any hint, thank you in advance!