Given below is the Cmake file for reference. I am able to build the shared library but unable to run the application due to undefined symbol ZN8libeitrt5inferEP5EiTrtPfS2_i
project(dsedgeimpulse)
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/libs)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(DEP_LIB ${CMAKE_SOURCE_DIR}/dsexample_lib/)
find_package(PkgConfig REQUIRED)
find_package(CUDA REQUIRED)
find_package(OpenCV REQUIRED)
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
pkg_check_modules(GSTREAMER_BASE REQUIRED gstreamer-base-1.0)
pkg_check_modules(GSTREAMER_VIDEO REQUIRED gstreamer-video-1.0)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_FLAGS " -fPIC -Wall -g -Wno-strict-aliasing -I. -Isource -Imodel-parameters -Itflite-model -Ithird_party/ -Os -DNDEBUG -DEI_CLASSIFIER_ENABLE_DETECTION_POSTPROCESS_OP=1 -g -Wno-asm-operand-widths -DTF_LITE_DISABLE_X86_NEON=1 -DEI_CLASSIFIER_USE_FULL_TFLITE=1")
message(CMAKE_C_FLAGS = ${CMAKE_C_FLAGS})
#set(CMAKE_CXX_FLAGS “-std=c++14”)
message(CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${GSTREAMER_INCLUDE_DIRS})
include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(/opt/nvidia/deepstream/deepstream/sources/includes/)
include_directories(/usr/local/include/opencv4/)
include_directories(tflite/linux-jetson-nano/)
include_directories(tensorflow-lite/)
include_directories(${DEP_LIB})
link_directories(${GSTREAMER_LIBRARY_DIRS})
link_directories(${CUDA_LIBRARY_DIRS})
link_directories(${OPENCV_LIBRARY_DIRS})
link_directories(${DEP_LIB})
link_directories(/opt/nvidia/deepstream/deepstream/lib)
link_directories(/opt/nvidia/deepstream/deepstream/lib/gst-plugins)
link_directories(/usr/local/cuda-10.2//lib64/)
link_directories(tflite/linux-jetson-nano/)
set(EI_SDK_FOLDER “${CMAKE_CURRENT_SOURCE_DIR}/edge-impulse-sdk”)
include(${EI_SDK_FOLDER}/cmake/utils.cmake)
#target_include_directories(app PRIVATE ${EI_SDK_FOLDER})
#RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}” “*.cpp”)
#RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}” “*.cc”)
#RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}” “*.c”)
#CSOURCES = $(wildcard edge-impulse-sdk/CMSIS/DSP/Source/TransformFunctions/.c) $(wildcard edge-impulse-sdk/CMSIS/DSP/Source/CommonTables/.c)
#$(wildcard edge-impulse-sdk/CMSIS/DSP/Source/BasicMathFunctions/.c) $(wildcard edge-impulse-sdk/CMSIS/DSP/Source/ComplexMathFunctions/.c)
#$(wildcard edge-impulse-sdk/CMSIS/DSP/Source/FastMathFunctions/.c) $(wildcard edge-impulse-sdk/CMSIS/DSP/Source/SupportFunctions/.c)
#$(wildcard edge-impulse-sdk/CMSIS/DSP/Source/MatrixFunctions/.c) $(wildcard edge-impulse-sdk/CMSIS/DSP/Source/StatisticsFunctions/.c)
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/DSP/Source/TransformFunctions” “*.c”)
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/DSP/Source/CommonTables” “*.c”)
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/DSP/Source/BasicMathFunctions” “*.c”)
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/DSP/Source/ComplexMathFunctions” “*.c”)
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/DSP/Source/FastMathFunctions” “*.c”)
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/DSP/Source/SupportFunctions” “*.c”)
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/DSP/Source/MatrixFunctions” “*.c”)
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/DSP/Source/StatisticsFunctions” “*.c”)
#check
RECURSIVE_FIND_FILE_APPEND(EI_SOURCE_FILES “${EI_SDK_FOLDER}/CMSIS/NN/Source” “*.c”)
#CSOURCES += edge-impulse-sdk/tensorflow/lite/c/common.c
LIST(APPEND EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/c/common.c”)
#CCSOURCES += $(wildcard edge-impulse-sdk/tensorflow/lite/kernels/.cc) $(wildcard edge-impulse-sdk/tensorflow/lite/kernels/internal/.cc)
#$(wildcard edge-impulse-sdk/tensorflow/lite/micro/kernels/.cc) $(wildcard edge-impulse-sdk/tensorflow/lite/micro/.cc)
#$(wildcard edge-impulse-sdk/tensorflow/lite/micro/memory_planner/.cc) $(wildcard edge-impulse-sdk/tensorflow/lite/core/api/.cc)
#message(EI_SOURCE_FILES="${EI_SOURCE_FILES}")
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/kernels” “*.cc”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/kernels/internal” “*.cc”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/micro/kernels” “*.cc”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/micro” “*.cc”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/micro/memory_planner” “*.cc”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/core/api” “*.cc”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/micro/memory_planner” “*.cc”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/tensorflow/lite/core/api” “*.cc”)
#CXXSOURCES = $(wildcard tflite-model/.cpp) $(wildcard edge-impulse-sdk/dsp/kissfft/.cpp)
#$(wildcard edge-impulse-sdk/dsp/dct/*.cpp) $(wildcard ./edge-impulse-sdk/dsp/memory.cpp)
#$(wildcard edge-impulse-sdk/porting/posix/.c) $(wildcard edge-impulse-sdk/porting/mingw32/.c)
#for gpu version only
LIST(APPEND EI_SOURCE_FILES “tflite-model/onnx-trained.cpp”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/dsp/kissfft” “*.cpp”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/dsp/dct” “*.cpp”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/dsp/dct” “*.cpp”)
LIST(APPEND EI_SOURCE_FILES “${EI_SDK_FOLDER}/dsp/memory.cpp”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/porting/posix” “*.cpp”)
RECURSIVE_FIND_FILE_APPEND (EI_SOURCE_FILES “${EI_SDK_FOLDER}/porting/mingw32” “*.cpp”)
add_library(nvdsgst_dsexample SHARED gstdsexample.cpp dsexample_lib/dsexample_lib.c ${EI_SOURCE_FILES} tflite/linux-jetson-nano/libei_debug.a )
#tflite/linux-jetson-nano/libcudart.so dsexample_lib/libdsexample.a tflite/linux-jetson-nano/libei_debug.a
target_link_libraries(nvdsgst_dsexample opencv_imgcodecs opencv_video opencv_imgproc opencv_core )
target_link_libraries(nvdsgst_dsexample ${CUDA_LIBRARIES})
target_link_libraries(nvdsgst_dsexample cudart dl nppc nppig npps nppicc nppidei )
target_link_libraries(nvdsgst_dsexample rt )
target_link_libraries(nvdsgst_dsexample ${GSTREAMER_VIDEO_LIBRARIES})
target_link_libraries(nvdsgst_dsexample nvdsgst_helper nvdsgst_meta nvds_meta nvbufsurface nvbufsurftransform )
target_link_libraries(nvdsgst_dsexample nvinfer nvonnxparser)
install(TARGETS nvdsgst_dsexample DESTINATION /opt/nvidia/deepstream/deepstream-6.0/lib/gst-plugins/)