tensorflow: hexagon delegate fails with -- dlopen failed: cannot locate symbol "dlopen"

I’m trying to get hexagon (Qualcomm’s NN accelerator DSP) working on Android, but following the instructions leads me here.

When I run my app, I get the following crash:

2022-05-05 11:22:07.315 20487-20487/org.tensorflow.lite.examples.detection E/AndroidRuntime: FATAL EXCEPTION: main
    Process: org.tensorflow.lite.examples.detection, PID: 20487
    java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "dlopen" referenced by "/data/app/~~oHfy74UV0cmPBaaworOtcA==/org.tensorflow.lite.examples.detection-KxIoTs7gEXEEvawBkjkh0A==/lib/arm64/libtensorflowlite_hexagon_jni.so"...
        at java.lang.Runtime.loadLibrary0(Runtime.java:1087)
        at java.lang.Runtime.loadLibrary0(Runtime.java:1008)
        at java.lang.System.loadLibrary(System.java:1664)
        at org.tensorflow.lite.examples.detection.tflite.TFLiteObjectDetectionAPIModel.create(TFLiteObjectDetectionAPIModel.java:145)

I’m trying to run this on the tflite object_detection example app from github.com/tensorflow/examples, on Android.

My Android device:

Device: Xiaomi Redmi Note 9 Pro

adb shell getprop ro.product.device
    joyeuse

adb shell getprop ro.board.platform
    atoll

If I adb shell into /data/app/~~oHfy74UV0cmPBaaworOtcA==/org.tensorflow.lite.examples.detection-KxIoTs7gEXEEvawBkjkh0A==/lib/arm64, and ls, then I see the following files:

libhexagon_interface.so                        
libhexagon_nn_skel.so                          
libhexagon_nn_skel_v65.so                      
libhexagon_nn_skel_v66.so                      
libtensorflowlite_hexagon_jni.so               
libtensorflowlite_jni.so                       

It seems very strange that dlopen itself is not found!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 50 (19 by maintainers)

Most upvoted comments

@karimnosseir , i am also seeing the same issue. i can run the tflite model using benchmark_model on adb command line and using nnapi delegage as well. however when i use hexagon delegate in my android app (java code), get the above error. simply following instructions here https://www.tensorflow.org/lite/android/delegates/hexagon

pls note that there are no instructions on how to add the lib hexagons (.so files) to the android app. some clear instructions would be helpful