-
Notifications
You must be signed in to change notification settings - Fork 74k
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
Linking issues with tensorflow-lite.a with android-studio and CMake. #19642
Comments
/CC @aselle |
Nagging Assignee @aselle: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly. |
@uelordi01 Have you resolved this issue? I also meet the similar problem. |
Unfortunately not, but I think my error is related to the architecture mismatch, actually when I tried to make objdump in the tf-lite static library it says that is x86-64 architecture. I think this Furthermore I tried to use this issue explanations: So it seems that we need an android toolchain to say to gcc or clang compiler the correct compilation flgs. |
Nagging Assignee @aselle: It has been 14 days with no activity and this issue has an assignee. Please update the label and/or status accordingly. |
@uelordi01 any reason you can use the bazel build? |
@uelordi01 : Let me know if you are still having issues, reopen the issue. |
hi, have you solved the "incompatible target" problem ? |
Currently I am able to compile the tensorflow-lite.a through bazel, and also I can build shared lib adding in tese lines to build_file:
|
@uelordi01 hi, follow your instruction, I get a libtensorflowLite.so and run it on mobile phone. But the size is nearly 37M, is it normal ? |
My tensorflow-lite library size is 34.7 MB, so I guess depending on the version of the tensorflow-lite is the reason that you have 37 MB size library. |
@uelordi01 yes, now I have integrate th dynamic library in my android project. |
@zhyj3038 Hi, how can you use the libtensorflowLite.so in an android project? which head files do you include ? |
@holyhao the whole tflite folder |
@zhyj3038 Thans for your reply, i have some trouble about compiling to the dynamic library. If any possible, would you please share it ? |
just add cc_binary( linkopts=["-shared", "-Wl"], copts = tflite_copts(), to any positon of tensorflow's BUILD file. the BUILD file is in tensorflow's root folder |
@zhyj3038 Because of some proxy problem , i failed compiling with bazel . |
@uelordi01 hi, I get a libtensorflowLite.so sucessfully, But the size is almost 40MB. I know that the offical libtensorflowlite_jni.so only 2.04MB, how could it be so different, do you have some idea? |
I cannot assure, but this can be due to the lite jni library could work as a wrapper to make calls to tensorflow-lite core functions, so in concluision, probably in this library are placed only wrapper functions. Another idea could be because the jni lit library linking could be done through static library where this library would have had only the operations that the jni library. |
@uelordi01, hi, I have the same problem when using
Would you mind sharing this ? :) (I'm able to build a shared lib but due to external limitations I need a static lib). |
System information
Have I written custom code:
OS Platform and Distribution ( ):
Linux Ubuntu 16.04 / Android
TensorFlow installed from:
source
Python version:
2.7
Bazel version (if compiling from source):
0.13
GCC/Compiler version (if compiling from source):
NDK16b
Describe the problem
I am having problems linking libtensorflow-lite.a with CMake and Android Studio.
It seems that the tf-lite library is not compatible with my architecture, but I do not know why this is happening.
I have succesfully compiled the libtensorflow-lite.a library, following these steps:
The problem comes when I try to link the library with CMake. it seems that even I compiled the armeabi-v7a the linker, I have these errors:
Source code / logs
This my error log:
My CmakeScript:
My build_gradle (I have only copy the relevant part)
The text was updated successfully, but these errors were encountered: