I'm trying to make a project where I use TFLite in my native c++ code through NDK inside my android application. So far I've build and tested TFLite on my pure c++ linux project. Now I want to build and run it on my Android project which uses a somewhat similar code base as my pure linux project, with an android UI on top. It should be on an ARM64 architecture
I was following the official docs (the non-docker part) which asked me to run ./configure
on my tensorflow file which I got from extracting the 2.11 release from it's github repo.
My first question is how do I properly set this up and compile everything? Currently I'm following this question which seems like a decent option but I would rather follow an official set of instructions (although as long as it works I'm fine).
My real question is this: Do I have to use NDK < 21? My project currently (because of other dependencies) only supports NDK > 22 which as you can tell creates a problem for me. Is there a way to build TFLite for NDK versions above 22?
When I run ./configure
and say yes to configuring ./WORKSPACE
I get this output:
WARNING: The NDK version in /home/user/Android/Sdk/ndk/25.1.8937393 is 25, which is not supported by Bazel (officially supported versions: [10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]). Please use another version. Compiling Android targets may result in confusing errors.
Traceback (most recent call last):
File "/home/user/Desktop/Android_build/tensorflow-2.11.0/./configure.py", line 1362, in <module>
main()
File "/home/user/Desktop/Android_build/tensorflow-2.11.0/./configure.py", line 1335, in main
create_android_ndk_rule(environ_cp)
File "/home/user/Desktop/Android_build/tensorflow-2.11.0/./configure.py", line 653, in create_android_ndk_rule
get_ndk_api_level(environ_cp, android_ndk_home_path))
File "/home/user/Desktop/Android_build/tensorflow-2.11.0/./configure.py", line 746, in get_ndk_api_level
api_levels = sorted(os.listdir(platforms))
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/Android/Sdk/ndk/25.1.8937393/platforms'
If possible, I just want to get the android compatible .so
files for clang++ so I can just add that to my pure C projects cmake file and ndk can run it.
I've installed NDK though android studios interface and I'm using debian 11.
Note: Since I'm not inside a project, there is no local.properties
file for me to edit and add the path. I'm trying to configure and run bazel inside the source directory I got from tensorflows github page.