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.

Linux/TDA2: Link to libopencv_objdetect.a fail!

Part Number: TDA2

Tool/software: Linux

Dear TI:

In VSDK Linux build environment,  I add in 

OPENCV_LIBS +=  $(OpenCV_PREBUILD_PATH)/libs_linux/libopencv_objdetect.a

in common_footer_a15.mk to enable the object detection.

but always get error when calling the object detection API:

cvHaarDetectObjects

/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(haar.cpp.o): In function `cvHaarDetectObjectsForROC(void const*, CvHaarClassifierCascade*, CvMemStorage*, std::vector<int, std::allocator<int> >&, std::vector<double, std::allocator<double> >&, double, int, int, CvSize, CvSize, bool)':
haar.cpp:(.text._Z25cvHaarDetectObjectsForROCPKvP23CvHaarClassifierCascadeP12CvMemStorageRSt6vectorIiSaIiEERS5_IdSaIdEEdii6CvSizeSC_b+0x4ca): undefined reference to `cvResize'
haar.cpp:(.text._Z25cvHaarDetectObjectsForROCPKvP23CvHaarClassifierCascadeP12CvMemStorageRSt6vectorIiSaIiEERS5_IdSaIdEEdii6CvSizeSC_b+0x1506): undefined reference to `cvCanny'
/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(cascadedetect.cpp.o): In function `cv::BaseCascadeClassifier::~BaseCascadeClassifier()':
cascadedetect.cpp:(.text._ZN2cv21BaseCascadeClassifierD2Ev+0x14): undefined reference to `cv::Algorithm::~Algorithm()'
/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(cascadedetect.cpp.o): In function `cv::CascadeClassifierImpl::CascadeClassifierImpl()':
cascadedetect.cpp:(.text._ZN2cv21CascadeClassifierImplC2Ev+0x26): undefined reference to `cv::Algorithm::Algorithm()'
/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(cascadedetect.cpp.o): In function `cv::FeatureEvaluator::setImage(cv::_InputArray const&, std::vector<float, std::allocator<float> > const&)':
cascadedetect.cpp:(.text._ZN2cv16FeatureEvaluator8setImageERKNS_11_InputArrayERKSt6vectorIfSaIfEE+0x206): undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
cascadedetect.cpp:(.text._ZN2cv16FeatureEvaluator8setImageERKNS_11_InputArrayERKSt6vectorIfSaIfEE+0x4bc): undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(cascadedetect.cpp.o):(.data.rel.ro._ZTVN2cv21CascadeClassifierImplE+0x20): undefined reference to `cv::Algorithm::save(cv::String const&) const'
/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(cascadedetect.cpp.o):(.data.rel.ro._ZTVN2cv21CascadeClassifierImplE+0x24): undefined reference to `cv::Algorithm::getDefaultName() const'
/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(cascadedetect.cpp.o):(.data.rel.ro._ZTIN2cv21BaseCascadeClassifierE+0x8): undefined reference to `typeinfo for cv::Algorithm'
/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(cascadedetect.cpp.o):(.data.rel.ro._ZTVN2cv21BaseCascadeClassifierE+0x20): undefined reference to `cv::Algorithm::save(cv::String const&) const'
/home/cheepeng/PROCESSOR_SDK_VISION_03_04_00_00/ti_components/open_compute/opencv/opencv-3.1.0/libs_linux/libopencv_objdetect.a(cascadedetect.cpp.o):(.data.rel.ro._ZTVN2cv21BaseCascadeClassifierE+0x24): undefined reference to `cv::Algorithm::getDefaultName() const'
collect2: error: ld returned 1 exit status

Please advise.

Thanks and best regards

He Wei

  • Hi He Wei,
    Could you please build without -s -j option & share the full log ?
    Need to check if it is including the lib or not ?

    Regards
    Surya
  • Dear Surya,

    The entire log is attached.

    I notice the libopencv_objdetect.a is linked, (If  I didn't include it in makefie, I will get another API error) and actually I have included all the pre-build OpenCV lib to avoid any dependency issue.

    Please advise.

    Thanks and best regards

    He Wei

    build_log.txt.tar.gz

  • Dear Surya,
    Any update? I google and notice the order to add in each static opencv lib could be matter. But I don't the correct order to add in. I understood TI has done the cross-compile and run the OpenCV test, Can I know during the OpenCV test, what is the order in the test application when linking to these opencv static libs? Especially how to add the object detection lib?

    Thanks and best regards
    He Wei
  • Hi He Wei,
    When OpenCV_test is enabled ,This is the order on which libs are linked to test application
    Please check if that helps you

    ifeq ($(ENABLE_OPENCV_TESTS),yes)
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_calib3d.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_core.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_features2d.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_imgcodecs.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_imgproc.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_objdetect.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_photo.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_stitching.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_superres.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_video.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_perf_videoio.a

    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_calib3d.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_core.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_features2d.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_flann.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_highgui.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_imgcodecs.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_imgproc.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_ml.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_objdetect.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_photo.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_shape.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_stitching.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_superres.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_video.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_test_videoio.a
    _OPENCVAPP_LIBS_a15_0 +=$(OpenCV_PATH)/libopencv_ts.a
    endif

    Regards
    Surya