Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlopen failed: cannot find "alizedOrThrow" from verneed[0] in DT_NEEDED list for "/base.apk!/lib/arm64-v8a/libxxxxtensorflowlite.so" #576

Open
liqiang311 opened this issue Nov 26, 2024 · 0 comments
Labels

Comments

@liqiang311
Copy link

liqiang311 commented Nov 26, 2024

Describe the bug

After modifying SONAME, dlopen failed with an error message "alizedOrThrow", while original .so is good.

Steps To Reproduce

Need android environment.

  1. Download tensorflow.so from https://maven.google.com/com/google/ai/edge/litert/litert/1.0.1/litert-1.0.1.aar.
  2. unzip this aar file, extract jni/arm64-v8a/libtensorflowlite_jni.so
cd  jni/arm64-v8a
cp libtensorflowlite_jni.so libxxxxtensorflowlite.so
patchelf-win64-0.18.0.exe --set-soname libxxxxtensorflowlite.so libxxxxtensorflowlite.so

Create a new Native project using Android Studio,
Modify the CMakeLists.txt,

target_link_libraries(${CMAKE_PROJECT_NAME}
        # List libraries link to the target library
        android
        ..../libtensorflowlite_jni.so
        ..../libxxxxtensorflowlite.so
        log)

Remember to only build arm64 version (change gradle).
Run the app in android machine, will crash.

16:09:05.009  E  FATAL EXCEPTION: main
                 Process: com.example.myapplication, PID: 3889
                 java.lang.UnsatisfiedLinkError: dlopen failed: cannot find "alizedOrThrow" from verneed[0] in DT_NEEDED list for "/data/app/~~vfaTCJFVfTxMw5UuEsnC6g==/com.example.myapplication-YOMgEdBU7xuzUrYWu0oSVw==/base.apk!/lib/arm64-v8a/libxxxxtensorflowlite.so"
                 	at java.lang.Runtime.loadLibrary0(Runtime.java:1082)
                 	at java.lang.Runtime.loadLibrary0(Runtime.java:1003)
                 	at java.lang.System.loadLibrary(System.java:1661)
                 	at com.example.myapplication.MainActivity.<clinit>(MainActivity.java:14)
                 	at java.lang.Class.newInstance(Native Method)
                 	at android.app.AppComponentFactory.instantiateActivity(AppComponentFactory.java:95)
                 	at androidx.core.app.CoreComponentFactory.instantiateActivity(CoreComponentFactory.java:45)
                 	at android.app.Instrumentation.newActivity(Instrumentation.java:1339)
                 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4053)
                 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4340)
                 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
                 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
                 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
                 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2584)
                 	at android.os.Handler.dispatchMessage(Handler.java:106)
                 	at android.os.Looper.loopOnce(Looper.java:226)
                 	at android.os.Looper.loop(Looper.java:313)
                 	at android.app.ActivityThread.main(ActivityThread.java:8810)
                 	at java.lang.reflect.Method.invoke(Native Method)
                 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
                 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Expected behavior

dlopen success.
only link original so is work.
only link modified so is not work.

patchelf --version output

patchelf-win64-0.18.0.exe --version
patchelf 0.18.0

Additional context

Add any other context about the problem here.

@liqiang311 liqiang311 added the bug label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant