ARM-software / armnn

Arm NN ML Software. The code here is a read-only mirror of https://review.mlplatform.org/admin/repos/ml/armnn
https://developer.arm.com/products/processors/machine-learning/arm-nn
MIT License
1.14k stars 307 forks source link

Link error on older Android devices #757

Closed GregCornis closed 4 months ago

GregCornis commented 4 months ago

I'm trying to use the AAR in an Android App, as presented in the AI Talk. The version with the GPU delegate works fine, but when I add the dependency on armnn_delegate_jni-23.11.aar and add an ArmnnDelegate() to the config, I get a link error:

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "strtod_l" referenced by "/data/app/com.*****/lib/arm64/libarmnn_delegate_jni.so"...
    at java.lang.Runtime.loadLibrary0(Runtime.java:989)
        at java.lang.System.loadLibrary(System.java:1562)
    at com.arm.armnn.delegate.ArmnnDelegate.<init>(ArmnnDelegate.kt:21)
    at com.cornis.core.image_processing.TFLiteSegmenter.<init>(TFLiteSegmenter.kt:24)

The device I am running on is on Android API 25, with a Mali T860.

I've found a related issue upstream, though I am not 100% sure what the link is: https://github.com/tensorflow/tensorflow/issues/61951.

nikraj01 commented 4 months ago

Hello @GregCornis ,

Thanks for raising the issue. They are mentioning about API level of ndk 26 in https://github.com/tensorflow/tensorflow/issues/61951

NDK_API_LEVEL="26" ANDROID_BUILD_TOOLS_VERSION="30.0.3" ANDROID_SDK_API_LEVEL="30"

Could you try with API 26 maybe?

GregCornis commented 4 months ago

Unfortunatly I cannot upgrade the device. From what I understood of tensorflow's issue, they mean to revert the NDK_API_LEVEL to 21 for next release, so I hope that I can use armnn on API 25. Is that explicitly not supported on your side ? Do you know where the error is coming from ?

nikraj01 commented 4 months ago

Hello @GregCornis ,

Looking at the code found out that we were building the AAR file targeting API level 27. That's why you were getting the error in your device which has API level of 25. I have got the build with the API of your device. I will let you know from where you can pick up the binary to test it.

Thanks, Nikhil.

GregCornis commented 4 months ago

Awesome thanks! I'm available for any test that you want me to do

GregCornis commented 4 months ago

Hi @nikraj01, any news on this issue ? Thanks :)

nikraj01 commented 4 months ago

Hi @GregCornis ,

Unfortunately I am waiting for some approval before I send it to you. I really appreciate your patience.

Thanks, Nikhil.

nikraj01 commented 4 months ago

Hello @GregCornis ,

Thanks very much for raising the issue and your patience. As its not an actual issue in Arm NN and is related to an older version of Android in your particular device, which is bit old and not something we have on our side to test it we won't be able to provide the AAR file. We don't want to provide a file to our users which is untested. We understand it should have been documented somewhere about the minimum API version support. For that reason we have now updated our release note for our latest release with the minimum API level we have tested and supported. Hope that clarifies the issue.

Thanks, Nikhil.

GregCornis commented 4 months ago

Alright, thank you anyway for looking into it