tensorflow: Can not find strtod_l function on Android device
1. System information
- OS Platform and Distribution: Android 5.1, OPPO device
- TensorFlow library : Tensorflow lite 2.13.0
When I try to load model and get error:
E/art: dlopen("/data/app/com.app.demo-1/lib/arm64/libtensorflowlite_jni.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "strtod_l" referenced by "/data/app/com.app.demo-1/lib/arm64/libtensorflowlite_jni.so"...
About this issue
- Original URL
- State: open
- Created 9 months ago
- Reactions: 3
- Comments: 43 (12 by maintainers)
We are considering patching 2.15, since that could be shipped a lot sooner than 2.16.
There doesn’t seem to be much benefit from patching 2.12-2.14, since users who are affected by this issue could just use 2.15 instead. (But please correct me if I am wrong about that.)
@fergushenderson I have just tried tensorflow-lite version 2.15.0. Now I am getting the following compilation error:
Looks like
guice
was introduced in 2.15.0 and requires minSdkVersion 26 which I guess stems from the use of Java 8 language features. Unfortunately, upgrading to 26 is not an option for our project.The fix has been cherry picked onto the r2.16 release branch, and TF Lite 2.16.1 has been released on Maven Central now. I have verified that the
libtensorflowlite_jni.so
files from TF Lite 2.16.1 do not contain any references tostrtod_l
. So this issue is fixed now.I tried this, but I get the following exception when initializing the
Interpreter
on SDK 23:According to the error messages, guice-5.1.0.jar is not compatible with Android 21. The Java support 8 of Android by desugaring seems not working with guice-5.1.0.jar, could you please consider removing it from the dependency list of tensorflow-lite?
We are going to fix this.
I have been discussing this with the TF Lite team, and we have consensus that this is a problem that should be fixed. I have analyzed the cause and possible solutions, and produced a prototype solution that allows use of AHardwareBuffer on versions of Android that support it while still remaining compatible with earlier versions of Android back to Android API level 21. A TF Lite team member (@turbotoribio) has taken on the remaining tasks to get this fix landed.
The main part of the fix has landed: https://github.com/tensorflow/tensorflow/commit/c7c3135b2802f3b8886f2ecefc39de49799b1e9b
The remaining parts are to change ANDROID_NDK_API_LEVEL from 26 back to 21.
The fix will be included in TF Lite 2.16.
https://github.com/tensorflow/tensorflow/blob/1bd1b7f4b0311575ead19f14e74488a97b524555/tensorflow/lite/g3doc/android/lite_build.md?plain=1#L126 Apparently , the minimum supported version of the official build is Android 8.0
It looks like the dependency on guice is probably not needed. So a possible work-around is to simply exclude that in your Gradle config file (e.g.
build.gradle
):[Credit to Khan LeViet for this suggestion.]
We have not tested this work-around yet, but I wanted to share it as soon as possible. Please let us know if this work-around works for you.
@fergushenderson Our project needs version 2.15 please help me to answer the release date