当前位置:   article > 正文

【已解决】ubuntu 16.04 源码编译opencv4.5.1 报错 “../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference t”

【已解决】ubuntu 16.04 源码编译opencv4.5.1 报错 “../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference t”

源码编译opencv可参考教程:在ubuntu下安装opencv4.1.0详细步骤icon-default.png?t=M4ADhttps://blog.csdn.net/weixin_44003563/article/details/90404745

在操作make -j8的时候报错如下:

  1. [ 25%] Linking CXX executable ../../bin/opencv_annotation
  2. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFReadRGBAStrip@LIBTIFF_4.0"
  3. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFReadDirectory@LIBTIFF_4.0"
  4. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFWriteEncodedStrip@LIBTIFF_4.0"
  5. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFIsTiled@LIBTIFF_4.0"
  6. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFWriteScanline@LIBTIFF_4.0"
  7. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFGetField@LIBTIFF_4.0"
  8. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFScanlineSize@LIBTIFF_4.0"
  9. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFWriteDirectory@LIBTIFF_4.0"
  10. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFReadEncodedTile@LIBTIFF_4.0"
  11. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFReadRGBATile@LIBTIFF_4.0"
  12. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFClose@LIBTIFF_4.0"
  13. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFClientOpen@LIBTIFF_4.0"
  14. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFRGBAImageOK@LIBTIFF_4.0"
  15. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFOpen@LIBTIFF_4.0"
  16. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFReadEncodedStrip@LIBTIFF_4.0"
  17. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFSetField@LIBTIFF_4.0"
  18. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFSetWarningHandler@LIBTIFF_4.0"
  19. /usr/bin/ld: ../../lib/libopencv_imgcodecs.so.4.5.0: undefined reference to "TIFFSetErrorHandler@LIBTIFF_4.0"
  20. collect2: error: ld returned 1 exit status
  21. make[2]: *** [apps/annotation/CMakeFiles/opencv_annotation.dir/build.make:95: bin/opencv_annotation] Erro 1
  22. make[1]: *** [CMakeFiles/Makefile2:18408: apps/annotation/CMakeFiles/opencv_annotation.dir/all] Erro 2
  23. make[1]: ** Waiting for other processes to finish.

对比cmake的时候也有警告:

  1. -- Configuring done
  2. CMake Warning at cmake/OpenCVUtils.cmake:1508 (add_library):
  3. Cannot generate a safe runtime search path for target opencv_imgcodecs
  4. because files in some directories may conflict with libraries in implicit
  5. directories:
  6. runtime library [libz.so.1] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  7. /home/zhangsan/anaconda3/lib
  8. runtime library [libpng16.so.16] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  9. /home/zhangsan/anaconda3/lib
  10. runtime library [libtiff.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  11. /home/zhangsan/anaconda3/lib

参考Ubuntu中安装openCV3.4.12编译过程中与Anaconda冲突icon-default.png?t=M4ADhttps://blog.csdn.net/weixin_43592742/article/details/116612141并且在之前安装教程基础上,下载了opencv_contrib并放到opencv目录下,再次按照上述教程执行,就成功了

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/535472
推荐阅读
  

闽ICP备14008679号