tensorflow / tensorflow

An Open Source Machine Learning Framework for Everyone
https://tensorflow.org
Apache License 2.0
182.89k stars 73.92k forks source link

Tensorflow lite build with CMake #66978

Open Thunderzen opened 1 week ago

Thunderzen commented 1 week ago

Issue type

Build/Install

Have you reproduced the bug with TensorFlow Nightly?

No

Source

source

TensorFlow version

2.4.1

Custom code

No

OS platform and distribution

Windows

Mobile device

No response

Python version

No response

Bazel version

No response

GCC/compiler version

arm-gnueabihf-4.9

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

After using cmake gui on the source files, I obtained the makefiles. Upon using the command make, I encountered these errors in the log

Standalone code to reproduce the issue

C:\tensorflow-2.4.1\tflite_build>make

Relevant log output

C:/tensorflow-2.4.1/tflite_build/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h:2164:43: error: 'fix' was not declared in this scope
                 straits.madd(a0,b0,c0,b0, fix<0>);

In file included from C:/tensorflow-2.4.1/tflite_build/eigen/Eigen/Core:348:0,
                 from C:/tensorflow-2.4.1/third_party/eigen3/Eigen/Core:1,
                 from C:/tensorflow-2.4.1/tensorflow/lite/kernels/internal/tensor_utils.h:21,
                 from C:/tensorflow-2.4.1/tensorflow/lite/kernels/internal/kernel_utils.cc:19:
C:/tensorflow-2.4.1/tflite_build/eigen/Eigen/src/Core/Reverse.h: In static member function 'static void Eigen::internal::vectorwise_reverse_inplace_impl<0>::run(ExpressionType&)':
google-ml-butler[bot] commented 1 week ago

Are you satisfied with the resolution of your issue? Yes No

Thunderzen commented 1 week ago

Are there any settings that i should disable in the cmake to solve this?

sawantkumar commented 1 week ago

Hi @Thunderzen ,

Let me replicate this issue and I will get back to you.

Thunderzen commented 4 days ago

@sawantkumar ,

Hi, any updates?

google-ml-butler[bot] commented 4 days ago

Are you satisfied with the resolution of your issue? Yes No

sawantkumar commented 1 day ago

Hi @Thunderzen ,

I tried replicating your issue but kept running into errors. can you tell me which version of cmake are you using ? and since you are building for arm , i will suggest you to look up on this .I tried cross compilaton for arm with latest tensorflow version and it worked without any issues . So, if the tflite version is not a constraint for you, can you try out with the latest tensorflow release. Meanwhile i will try to replicate your issue on my machine and will get back to you.

Thunderzen commented 1 day ago

Hi @sawantkumar ,

I am using CMake version 3.29. I found that different versions of tensorflow had different compatibility for a build with arm systems. For example, I found tensorflow 2.6 to be able to build on cmake and generate the libtensorflowlite.a file. So i guess it might be a version issue. If i tried even higher versions, there will be an error, usually stating that there was missing project files. So perhaps 2.6 suits best for arm system with my compiler.

Another question I would like to ask is how can i make use of libtensorflowlite.a to build projects? eg. on an ide like eclipse which requires library and include paths. It seems that I would need to build an entire project based on cmake in this minimal example shown in https://www.tensorflow.org/lite/guide/build_cmake#create_a_cmake_project_which_uses_tensorflow_lite