tensorflow: Cross-build failed tensorflow lite demo minimal
Click to expand!
Issue Type
Bug
Source
source
Tensorflow Version
tf 2.10
Custom Code
No
OS Platform and Distribution
Ubuntu 18.04
Mobile device
arm32
Python version
No response
Bazel version
No response
GCC/Compiler version
clang 10
CUDA/cuDNN version
No response
GPU model and memory
No response
Current Behaviour?
* I follow the document[https://github.com/tensorflow/tensorflow/blob/v2.10.0/tensorflow/lite/examples/minimal/README.md] to build the minimal demo
mkdir build_minimal
cd build_minimal
cmake -DCMAKE_TOOLCHAIN_FILE=/home/yons/data/ohos-sdk/linux/native/build/cmake/ohos.toolchain.cmake ../tensorflow/lite/examples/minimal/
cmake --build . -j 20
- I got error
Building CXX object CMakeFiles/minimal.dir/minimal.cc.obj
clang++: warning: argument unused during compilation: '--gcc-toolchain=/home/yons/data/ohos-sdk/linux/native/llvm' [-Wunused-command-line-argument]
In file included from /home/yons/data/tensorflow/tensorflow/lite/examples/minimal/minimal.cc:17:
In file included from /home/yons/data/tensorflow/tensorflow/lite/kernels/register.h:18:
In file included from /home/yons/data/tensorflow/tensorflow/lite/model.h:21:
/home/yons/data/tensorflow/tensorflow/lite/interpreter_builder.h:26:10: fatal error: 'flatbuffers/flatbuffers.h' file not found
#include "flatbuffers/flatbuffers.h" // from @flatbuffers
^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
CMakeFiles/minimal.dir/build.make:62: recipe for target 'CMakeFiles/minimal.dir/minimal.cc.obj' failed
make[2]: *** [CMakeFiles/minimal.dir/minimal.cc.obj] Error 1
CMakeFiles/Makefile2:1295: recipe for target 'CMakeFiles/minimal.dir/all' failed
make[1]: *** [CMakeFiles/minimal.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
- Please guide me to configure the include directory!
- thanks for your time!
### Standalone code to reproduce the issue
```shell
https://github.com/tensorflow/tensorflow/tree/v2.10.0/tensorflow/lite/examples/minimal
- I change the
CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(minimal C CXX)
set(TENSORFLOW_SOURCE_DIR "" CACHE PATH
"Directory that contains the TensorFlow project"
)
if(NOT TENSORFLOW_SOURCE_DIR)
get_filename_component(TENSORFLOW_SOURCE_DIR
"${CMAKE_CURRENT_LIST_DIR}/../../../../"
ABSOLUTE
)
endif()
add_subdirectory(
"${TENSORFLOW_SOURCE_DIR}/tensorflow/lite"
"${CMAKE_CURRENT_BINARY_DIR}/tensorflow-lite"
EXCLUDE_FROM_ALL
)
message(TARCE "TuT " ${TENSORFLOW_SOURCE_DIR})
include_directories(${TENSORFLOW_SOURCE_DIR}/)
#include_directories(${CMAKE_CURRENT_LIST_DIR}/flatbuffers/include)
set(CMAKE_CXX_STANDARD 17)
add_executable(minimal
minimal.cc
)
add_library(tf-lite STATIC IMPORTED )
set_target_properties(
tf-lite
PROPERTIES IMPORTED_LOCATION
/home/yons/data/tensorflow/build_lite/libtensorflow-lite.a
)
target_link_libraries(minimal
tf-lite
)
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (5 by maintainers)
Hi ,all Thanks for your time. @mohantym @sachinprasadhs @bhupendrarajput98
@bhupendrarajput98 @mohantym Hi, all
I have seen this issue and I tried https://stackoverflow.com/questions/72129186/tensorflow-2-8-cmake-static-built-static-library-showing-undefined-reference-for and it worked