[Android] Symbol resolution error in 0.0.13: "cannot locate symbol ggml_argsort_top_k"
Problem
Nexa SDK 0.0.13 crashes on Android with a symbol resolution error when initializing. This is a regression from 0.0.11 which works correctly.
Error
dlopen failed: cannot locate symbol "ggml_argsort_top_k" referenced by "/data/app/.../lib/arm64/libnexa_cpu_gpu.so"...
Stack Trace
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "ggml_argsort_top_k" at com.nexa.sdk.NexaSdk.init(NexaSdk.kt:21)
Analysis
libnexa_cpu_gpu.soreferencesggml_argsort_top_k(undefined symbol:U)libggml-base.soexportsggml_argsort_top_k(defined symbol:T)- The symbol exists but isn't visible during runtime linking
Environment
- SDK Version: 0.0.13
- Device: Xiaomi M2012K11AG (Snapdragon)
- Android Version: 13 (API 33)
- Target SDK: 36
Reproduction
- Add
implementation("ai.nexa:core:0.0.13")to build.gradle - Call
NexaSdk.getInstance().init(context) - App crashes with symbol resolution error
Attempted Workarounds
Pre-loading libraries doesn't help due to namespace isolation:
System.loadLibrary("ggml-base")
System.loadLibrary("ggml-cpu")
System.loadLibrary("nexa_bridge")
// Still fails when loading libnexa_cpu_gpu.so
Workaround
Downgrading to 0.0.11 resolves the issue:
implementation("ai.nexa:core:0.0.11")
Expected Behavior
SDK should initialize without symbol resolution errors, as it did in 0.0.11.
Suspected Root Cause
Possible build configuration issue in 0.0.13:
- Missing DT_NEEDED entry for libggml-base.so in libnexa_cpu_gpu.so
- Or incorrect linker flags during native library build
Related
Related to #886 (16KB page alignment), but this is a separate symbol linking issue in 0.0.13.
Request
Please fix the symbol visibility/linking in 0.0.13 and ensure native dependencies are properly declared.
I have not reproduced your issue. Additionally, why did you use the ndk r28? This is not necessary for this sdk.
Make it what it should be
Keith cox
On Wed, Dec 10, 2025 at 10:42 PM nfl-nexa @.***> wrote:
nfl-nexa left a comment (NexaAI/nexa-sdk#915) https://github.com/NexaAI/nexa-sdk/issues/915#issuecomment-3639938079
I have not reproduced your issue. Additionally, why did you use the ndk r28?
— Reply to this email directly, view it on GitHub https://github.com/NexaAI/nexa-sdk/issues/915#issuecomment-3639938079, or unsubscribe https://github.com/notifications/unsubscribe-auth/BN5OQI46LZ2APEY4LLKFIH34BDRZ5AVCNFSM6AAAAACOPJAYVGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMZZHEZTQMBXHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I have not reproduced your issue. Additionally, why did you use the ndk r28? This is not necessary for this sdk.
It's not related to r28, I tried without it. the error still occurs. The error happens inside NexaSdk.init() when it tries to load the plugin:
NexaSdk: Loading plugin: libnexa_plugin_cpu_gpu.so NexaSdk: dlopen failed: cannot locate symbol "ggml_argsort_top_k" referenced by "libnexa_cpu_gpu.so" RuntimeException: Cannot find cpu_gpu in /data/app/.../lib/arm64
I have not reproduced your issue. Additionally, why did you use the ndk r28? This is not necessary for this sdk.
It's not related to r28, I tried without it. the error still occurs. The error happens inside NexaSdk.init() when it tries to load the plugin:
NexaSdk: Loading plugin: libnexa_plugin_cpu_gpu.so NexaSdk: dlopen failed: cannot locate symbol "ggml_argsort_top_k" referenced by "libnexa_cpu_gpu.so" RuntimeException: Cannot find cpu_gpu in /data/app/.../lib/arm64
Working fine with 0.0.11.
@nfl-nexa plz reproduce and follow
@nfl-nexa @zhiyuan8
Update: The symbol resolution issue still exists in version 0.0.15
Error Details:
Same error as originally reported, now occurring with ai.nexa:core:0.0.15:
NexaSdk: Loading plugin: libnexa_plugin_cpu_gpu.so NexaSdk: dlopen failed: cannot locate symbol "ggml_argsort_top_k" referenced by "libnexa_cpu_gpu.so" RuntimeException: Cannot find cpu_gpu in /data/app/.../lib/arm64
Stack Trace (0.0.15):
java.lang.RuntimeException: Cannot find cpu_gpu in /data/app/.../lib/arm64 at com.nexa.sdk.NexaSdk.init(NexaSdk.kt:21) at com.freeai.chat.data.inference.NexaInferenceEngine.ensureSdkInitialized
The SDK has been updated to version 0.0.16. Please upgrade and try again.Now, the SDK initialization has added context environment checking.You can determine whether the initialization was successful by calling NexaSdk.getInstance().init(context, .InitCallback).