shubham0204 / Sentence-Embeddings-Android

Embeddings from sentence-transformers in Android! Supports all-MiniLM-L6-V2, bge-small-en, snowflake-arctic models and more
https://proandroiddev.com/from-python-to-android-hf-sentence-transformers-embeddings-1ecea0ce94d8
Apache License 2.0
24 stars 1 forks source link

[Bug] Cannot locate symbol "_Unwind_GetTextRelBase" - x64 emulator #1

Open shubham0204 opened 3 months ago

shubham0204 commented 3 months ago

An application using the library crashes on an x64 emulator with the following error:

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_Unwind_GetTextRelBase" referenced by "/data/app/.../base.apk!/lib/x86_64/libhftokenizer.so"...

On examining the libhftokenizer.so carefully (with ldd), we notice the following dependency:

$> ldd libhftokenizer.so
        linux-vdso.so.1 (0x00007ffeac3b8000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff4a44db000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff4a4ada000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ff4a43fc000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007ff4a43dc000)

References:

  1. https://stackoverflow.com/a/76095789/13546426
  2. https://stackoverflow.com/a/58565529/13546426

The issue was discovered by @greenrobot

shubham0204 commented 3 months ago

Converting a static library may result in the application not loading the jniLibs/<arch>/libhftokenizer.a as Android does not package the static libraries in the APK. A possible workaround could be downloading the static libraries from a remote source or copying them to the local file-system from the assets folder.