This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: EdgeAI TIDL compilation - undefined reference to `cv::Mat::Mat() error

Part Number: TDA4VM
Other Parts Discussed in Thread: AM69A

Hello,

I am following the instructions as in edgeai-tidl-tools/README.md at master · TexasInstruments/edgeai-tidl-tools (github.com), however getting error during linking as :  undefined reference to `cv::Mat::Mat()' at multiple places.

example:

 /usr/bin/ld: CMakeFiles/dlr_main.dir/dlr_main.cpp.o: in function `dlr::main::runInference(tidl::modelInfo::ModelInfo*, tidl::arg_parsing::Settings*)':
dlr_main.cpp:(.text+0x1178): undefined reference to `cv::Mat::Mat()'

Should opencv be separately installed? Do we have unaccounted dependencies which are not included as part of SDK?

  • Hi,

    Can you share more details ?

    Are you using TVM OSRT flow ?

    Can you share usecase you are trying, detailed error logs would be good to look into

  • Hi,

    I am just typing the instructions as in : " edgeai-tidl-tools/README.md at master · TexasInstruments/edgeai-tidl-tools (github.com)". No other modifications

    I typed,

    rk@ubuntu-22-04-3:~/edgeai-tidl-tools$ export SOC=am69a
    rk@ubuntu-22-04-3:~/edgeai-tidl-tools$ export TIDL_TOOLS_PATH=$(pwd)/tidl_tools
    rk@ubuntu-22-04-3:~/edgeai-tidl-tools$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TIDL_TOOLS_PATH
    rk@ubuntu-22-04-3:~/edgeai-tidl-tools$ export ARM64_GCC_PATH=$(pwd)/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu
    rk@ubuntu-22-04-3:~/edgeai-tidl-tools$ mkdir build && cd build
    rk@ubuntu-22-04-3:~/edgeai-tidl-tools/build$ cmake ../examples && make -j && cd ..

    log from terminal

    85%] Linking CXX executable /home/rk/edgeai-tidl-tools/bin/Release/dlr_main
    [ 88%] Linking CXX executable /home/rk/edgeai-tidl-tools/bin/Release/tfl_main
    /usr/bin/ld: CMakeFiles/dlr_main.dir/dlr_main.cpp.o: in function `dlr::main::runInference(tidl::modelInfo::ModelInfo*, tidl::arg_parsing::Settings*)':
    dlr_main.cpp:(.text+0x1178): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o): in function `cv::Mat tidl::preprocess::preprocImage<unsigned char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*, tidl::modelInfo::PreprocessImageConfig)':
    pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x5c): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x71): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o): in function `cv::Mat tidl::preprocess::preprocImage<float>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float*, tidl::modelInfo::PreprocessImageConfig)':
    pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o):pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x5c): more undefined references to `cv::Mat::Mat()' follow
    collect2: error: ld returned 1 exit status
    make[2]: *** [osrt_cpp/dlr/CMakeFiles/dlr_main.dir/build.make:101: /home/rk/edgeai-tidl-tools/bin/Release/dlr_main] Error 1
    make[1]: *** [CMakeFiles/Makefile2:483: osrt_cpp/dlr/CMakeFiles/dlr_main.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    [ 92%] Linking CXX executable /home/rk/edgeai-tidl-tools/bin/Release/tfl_priority_scheduling
    /usr/bin/ld: CMakeFiles/tfl_main.dir/tfl_main.cpp.o: in function `tflite::main::runInference(tidl::modelInfo::ModelInfo*, tidl::arg_parsing::Settings*)':
    tfl_main.cpp:(.text+0xd35): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o): in function `cv::Mat tidl::preprocess::preprocImage<unsigned char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*, tidl::modelInfo::PreprocessImageConfig)':
    pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x5c): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x71): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o): in function `cv::Mat tidl::preprocess::preprocImage<float>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float*, tidl::modelInfo::PreprocessImageConfig)':
    pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o):pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x5c): more undefined references to `cv::Mat::Mat()' follow
    collect2: error: ld returned 1 exit status
    make[2]: *** [osrt_cpp/tfl/CMakeFiles/tfl_main.dir/build.make:101: /home/rk/edgeai-tidl-tools/bin/Release/tfl_main] Error 1
    make[1]: *** [CMakeFiles/Makefile2:341: osrt_cpp/tfl/CMakeFiles/tfl_main.dir/all] Error 2
    /usr/bin/ld: CMakeFiles/tfl_priority_scheduling.dir/tfl_priority_scheduling.cpp.o: in function `tflite::main::getInvokeTime(tflite::main::tfl_model_struct*)':
    tfl_priority_scheduling.cpp:(.text+0xe9e): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: CMakeFiles/tfl_priority_scheduling.dir/tfl_priority_scheduling.cpp.o: in function `tflite::main::infer(void*)':
    tfl_priority_scheduling.cpp:(.text+0x28bf): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o): in function `cv::Mat tidl::preprocess::preprocImage<unsigned char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*, tidl::modelInfo::PreprocessImageConfig)':
    pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x5c): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x71): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o):pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): more undefined references to `cv::Mat::Mat()' follow
    [ 96%] Linking CXX executable /home/rk/edgeai-tidl-tools/bin/Release/ort_main
    collect2: error: ld returned 1 exit status
    make[2]: *** [osrt_cpp/advanced_examples/tfl/CMakeFiles/tfl_priority_scheduling.dir/build.make:101: /home/rk/edgeai-tidl-tools/bin/Release/tfl_priority_scheduling] Error 1
    make[1]: *** [CMakeFiles/Makefile2:370: osrt_cpp/advanced_examples/tfl/CMakeFiles/tfl_priority_scheduling.dir/all] Error 2
    /usr/bin/ld: CMakeFiles/ort_main.dir/onnx_main.cpp.o: in function `onnx::main::runInference(tidl::modelInfo::ModelInfo*, tidl::arg_parsing::Settings*)':
    onnx_main.cpp:(.text+0x17ea): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o): in function `cv::Mat tidl::preprocess::preprocImage<unsigned char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*, tidl::modelInfo::PreprocessImageConfig)':
    pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x5c): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x71): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o): in function `cv::Mat tidl::preprocess::preprocImage<float>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, float*, tidl::modelInfo::PreprocessImageConfig)':
    pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o):pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x5c): more undefined references to `cv::Mat::Mat()' follow
    collect2: error: ld returned 1 exit status
    make[2]: *** [osrt_cpp/ort/CMakeFiles/ort_main.dir/build.make:101: /home/rk/edgeai-tidl-tools/bin/Release/ort_main] Error 1
    make[1]: *** [CMakeFiles/Makefile2:512: osrt_cpp/ort/CMakeFiles/ort_main.dir/all] Error 2
    [100%] Linking CXX executable /home/rk/edgeai-tidl-tools/bin/Release/ort_priority_scheduling
    /usr/bin/ld: CMakeFiles/ort_priority_scheduling.dir/ort_priority_scheduling.cpp.o: in function `onnx::main::getInvokeTime(onnx::main::ort_model_struct*)':
    ort_priority_scheduling.cpp:(.text+0x20f6): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: CMakeFiles/ort_priority_scheduling.dir/ort_priority_scheduling.cpp.o: in function `onnx::main::infer(void*)':
    ort_priority_scheduling.cpp:(.text+0x47f1): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o): in function `cv::Mat tidl::preprocess::preprocImage<unsigned char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned char*, tidl::modelInfo::PreprocessImageConfig)':
    pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x5c): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIhEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x71): undefined reference to `cv::Mat::Mat()'
    /usr/bin/ld: /home/rk/edgeai-tidl-tools/lib/Release/libpre_process.a(pre_process.cpp.o):pre_process.cpp:(.text._ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE[_ZN4tidl10preprocess12preprocImageIfEEN2cv3MatERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPT_NS_9modelInfo21PreprocessImageConfigE]+0x47): more undefined references to `cv::Mat::Mat()' follow
    collect2: error: ld returned 1 exit status
    make[2]: *** [osrt_cpp/advanced_examples/ort/CMakeFiles/ort_priority_scheduling.dir/build.make:101: /home/rk/edgeai-tidl-tools/bin/Release/ort_priority_scheduling] Error 1
    make[1]: *** [CMakeFiles/Makefile2:399: osrt_cpp/advanced_examples/ort/CMakeFiles/ort_priority_scheduling.dir/all] Error 2
    make: *** [Makefile:136: all] Error 2

  • Can you share which SDK Tag you are on ?

  • Hi,

    There seems to be issue with the environment setup.

    As I see in my local environment setup, for 09_01_00_02 for AM69A device, OpenCV package is installed as part of setup script, at location

    </home>/9-1-0-2/am69a/edgeai-tidl-tools/tidl_tools/osrt_deps/opencv_4.2.0_x86_u22/

    Can you confirm the same at your end ? if this not installed correctly can you re run the setup script ? 

    I have replicated the above mentioned build at my end and its working fine for me, please refer attached SS, there could be env issue at your end is what i am thinking.