Getting different tensorflow lite 2.8.0 shared libraries for Android when cross-compile it with bazel and cmake

Hi All!
I’m trying to build TensorFlow Lite 2.8.0 shared library for android with cmake.

Using environment:
Ubuntu 20.04.4;
Android SDK 32;
Android NDK 20b (20.1.5948944);
TensorFlow Lite 2.8.0;

Firstly, to check my model, I built TensorFlow Lite 2.8.0 with bazel.
I just made next in folder with TFLite sources:

bazel \ \ \
        build --config=android_arm64 -c opt //tensorflow/lite/

Also I added next .tf_configure.bazelrc file in folder with TFLite sources:

build --action_env ANDROID_NDK_HOME="/home/Android/Sdk/ndk/20.1.5948944/"
build --action_env ANDROID_NDK_API_LEVEL="20"
build --action_env ANDROID_SDK_HOME="/home/Android/Sdk"

And result lib works fine! I mean, my model with result works as expected.

After it, I tried to build using cmake.
I made next script and placed it in the build folder near folder with TFLite sources:

  -DANDROID_ABI=arm64-v8a \
cmake --build . -j

I got target file.
But my model doesn’t work correct with this lib.

I thought that difference in assembly may be in dependencies versions. But after checking .cmake files in TFLite sources folder
/tensorflow/lite/tools/cmake/modules I noticed that all modules are synchronized with tensorflow/third_party workspace.bzl.
So I haven’t got idea what the difference in building process with bazel and cmake.
If someone know what I should to do to get with cmake the same as with bazel, please tell me.
I will very glad if somebody can help me.

1 Like

I had different dependencies of XNN pack for different build systems.
For bazel it was XNNPACK with TAG 69fa3b3707acd05e533db87b627e36def4886846.
And for cmake it was XNNPACK with TAG 113092317754c7dea47bfb3cb49c4f59c3c1fa10.
It was my bad.
Sorry and thanks!