Forums - dlopen failed: cannot find "libadsprpc.so"

6 posts / 0 new
Last post
dlopen failed: cannot find "libadsprpc.so"
neel.parikh
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.

  • Up0
  • Down0
guillaume.poirier
Join Date: 16 Feb 17
Posts: 7
Posted: Tue, 2017-10-03 07:13

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:

include $(CLEAR_VARS)
LOCAL_MODULE := calculator_test-prebuilt
LOCAL_SRC_FILES += $(LOCAL_PATH)/libs/libcalculator_test.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := calculator-prebuilt
LOCAL_SRC_FILES += $(LOCAL_PATH)/libs/libcalculator.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

Then I create a library that will try to call calculator_test() function inside libcalculator_test.so.

LOCAL_MODULE := mylib
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_C_INCLUDES += Mylib.h
LOCAL_SRC_FILES := Mylib.cpp
LOCAL_SHARED_LIBRARIES := calculator_test-prebuilt calculator-prebuilt
LOCAL_LDLIBS += -llog -ldl -landroid

include $(BUILD_SHARED_LIBRARY)

I load both libcalculator_test.so and libcalculator.so from my Java code:

System.loadLibrary("mylib");
System.loadLibrary("calculator_test");
System.loadLibrary("calculator");

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 !

  • Up0
  • Down0
guillaume.poirier
Join Date: 16 Feb 17
Posts: 7
Posted: Tue, 2017-10-03 13:30

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:

include $(CLEAR_VARS)
LOCAL_MODULE := adspprc-prebuilt
LOCAL_SRC_FILES += $(LOCAL_PATH)/libs/libadsprpc.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := c++-prebuilt
LOCAL_SRC_FILES += $(LOCAL_PATH)/libs/libc++.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

And load them in Java:

System.loadLibrary("adsprpc");
System.loadLibrary("c++");
  • Up0
  • Down0
chenxin511
Join Date: 25 Jun 17
Posts: 5
Posted: Sat, 2017-10-14 01:39

I have the same problem with you, have you soloved this problem?

  • Up0
  • Down0
gaolx2
Join Date: 15 Sep 17
Posts: 2
Posted: Tue, 2018-01-09 01:38

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:

 

Dynamic section at offset 0xf28 contains 20 entries:
  Tag        Type                         Name/Value
 0x00000003 (PLTGOT)                     0x1ff0
 0x00000002 (PLTRELSZ)                   8 (bytes)
 0x00000017 (JMPREL)                     0x3e8
 0x00000014 (PLTREL)                     REL
 0x00000006 (SYMTAB)                     0x128
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000005 (STRTAB)                     0x218
 0x0000000a (STRSZ)                      294 (bytes)
 0x00000004 (HASH)                       0x340
 0x00000001 (NEEDED)                     Shared library: [liblog.so]
 0x00000001 (NEEDED)                     Shared library: [libm.so]
 0x00000001 (NEEDED)                     Shared library: [libstdc++.so]
 0x00000001 (NEEDED)                     Shared library: [libc.so]
 0x00000010 (SYMBOLIC)                   0x0
 0x0000001e (FLAGS)                      SYMBOLIC BIND_NOW
 0x6ffffffb (FLAGS_1)                    Flags: NOW
 0x6ffffff0 (VERSYM)                     0x390
 0x6ffffffc (VERDEF)                     0x3b0
 0x6ffffffd (VERDEFNUM)                  2
 0x00000000 (NULL)                       0x0
 

 

  • Up0
  • Down0
vasiliy.sabadazh
Join Date: 20 Feb 18
Posts: 2
Posted: Wed, 2018-03-07 14:33

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!

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.