Hi everyone,
I have a little issue with my Cmake configuration.
This is the structure of my program:
I have two different cmake files:
1- for exec.out, the executable which links a static library lib.a.
2- for lib.a that contains some references to tensorflow-lite library ‘libtensorflow-lite’
In the lib.a Cmake file I inserted the ‘fetch Content’ to get tflite:
function(add_local_tflite)
set(FETCHCONTENT_FULLY_DISCONNECTED OFF)
set(FETCHCONTENT_QUIET OFF)
include(FetchContent)
FetchContent_Declare(
tflite
GIT_REPOSITORY https://github.com/tensorflow/tensorflow.git # Repository TensorFlow
GIT_TAG v2.9.1 # Versione 2.9.1 di TensorFlow Lite
SOURCE_SUBDIR tensorflow/lite # Directory relativa del progetto TensorFlow Lite
)
FetchContent_MakeAvailable(tflite)
endfunction(add_local_tflite)
and
target_link_libraries(${PROJECT_NAME} PRIVATE tensorflow-lite)
target_include_directories(${PROJECT_NAME} PRIVATE ${tensorflow-lite_SOURCE_DIR})
No error for this part.
In the Cmake of the executable I linked the library:
target_link_libraries(myexec PRIVATE lib)
I have a problem with the linker because I get some ‘undefined reference’ errors for the object of tflite used in the library:
undefined reference to `tflite::FlatBufferModel::~FlatBufferModel()'
undefined reference to `tflite::Interpreter::~Interpreter()'
The executable code does not use any references to tflite.
what am I missing?