在Xavier上编译inference,找不到opencv
Created by: FibonacciSun
分支: trt_infer
---------------------- log 如下:------ [ 86%] Built target libpaddleseg_inference make[2]: *** No rule to make target '/home/chris/download/opencv-3.4.1/build/lib/libopencv_imgcodecs.a', needed by 'detection_demo'. Stop. CMakeFiles/Makefile2:80: recipe for target 'CMakeFiles/detection_demo.dir/all' failed make[1]: *** [CMakeFiles/detection_demo.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2
原因:
我在xavier上构建出来的opencv的lib(官网载的opencv-3.4.1),库名称后面有个后缀,例如libopencv_imgcodecs.a 在xavier是如下的:
/home/chris/download/opencv-3.4.1/build/lib/libopencv_imgcodecs_pch_dephelp.a
----------------- 我的解决方法 ------------ 用 find_package(OpenCV REQUIRED)
替换CMakeList里的如下一堆东西
52 - set(DEPS ${DEPS} ${OPENCV_LIB_DIR}/libopencv_imgcodecs${CMAKE_STATIC_LIBRARY_SUFFIX}) 53 - set(DEPS ${DEPS} ${OPENCV_LIB_DIR}/libopencv_imgproc${CMAKE_STATIC_LIBRARY_SUFFIX}) 54 - set(DEPS ${DEPS} ${OPENCV_LIB_DIR}/libopencv_core${CMAKE_STATIC_LIBRARY_SUFFIX}) 55 - set(DEPS ${DEPS} ${OPENCV_LIB_DIR}/libopencv_highgui${CMAKE_STATIC_LIBRARY_SUFFIX}) 56 - set(DEPS ${DEPS} ${OPENCV_3RD_LIB_DIR}/libIlmImf${CMAKE_STATIC_LIBRARY_SUFFIX}) 57 - set(DEPS ${DEPS} ${OPENCV_3RD_LIB_DIR}/liblibjasper${CMAKE_STATIC_LIBRARY_SUFFIX}) 58 - set(DEPS ${DEPS} ${OPENCV_3RD_LIB_DIR}/liblibpng${CMAKE_STATIC_LIBRARY_SUFFIX}) 59 - set(DEPS ${DEPS} ${OPENCV_3RD_LIB_DIR}/liblibtiff${CMAKE_STATIC_LIBRARY_SUFFIX}) 60 - set(DEPS ${DEPS} ${OPENCV_3RD_LIB_DIR}/libittnotify${CMAKE_STATIC_LIBRARY_SUFFIX}) 61 - set(DEPS ${DEPS} ${OPENCV_3RD_LIB_DIR}/liblibjpeg-turbo${CMAKE_STATIC_LIBRARY_SUFFIX}) 62 - set(DEPS ${DEPS} ${OPENCV_3RD_LIB_DIR}/liblibwebp${CMAKE_STATIC_LIBRARY_SUFFIX}) 63 - set(DEPS ${DEPS} ${OPENCV_3RD_LIB_DIR}/libzlib${CMAKE_STATIC_LIBRARY_SUFFIX})