opencv3.4.0 安装过程中出现的问题

时间:2022-05-24 00:43:24

重新安装opencv3.4.0

参考安装博客:

opencv 安装版本测试:pkg-config --modversion opencv

https://blog.csdn.net/cocoaqin/article/details/78163171

卸载opencv的方式:进入opencv源码build目录

make uninstall

cd ..

sudo rm -r build

sudo rm -r /usr/local/include/opencv2 /usr/local/include/opencv /usr/include/opencv /usr/include/opencv2 /usr/local/share/opencv /usr/local/share/OpenCV /usr/share/opencv /usr/share/OpenCV /usr/local/bin/opencv* /usr/local/lib/libopencv*

安装过程中出现以下问题:

问题(1)

/usr/bin/ld: /usr/local/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared object; recompile with -fPIC

/usr/local/lib/libavformat.a: error adding symbols: Bad value

collect2: error: ld returned 1 exit status

modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:256: recipe for target 'lib/libopencv_videoio.so.3.4.0' failed

make[2]: *** [lib/libopencv_videoio.so.3.4.0] Error 1

CMakeFiles/Makefile2:7097: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed

make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2

Makefile:160: recipe for target 'all' failed

make: *** [all] Error 2

解决方式:网上大部分网友说是FFMPEG未安装好的原因,因此需要把依赖库按要求安装好,参考:

https://blog.csdn.net/jasonzzj/article/details/53587889

https://www.cnblogs.com/arkenstone/p/6490017.html

https://github.com/DeaDBeeF-Player/deadbeef/issues/1691

https://blog.csdn.net/zwlq1314521/article/details/44981547

问题(2)opencv3.4.0在编译ocl_test.hpp文件过程中INTER_LINEAR_EXATC找不到声明

解决方式:将该文件中用到INTER_LINEAR_EXATC的地方 换成5这个值,参考网址:

https://blog.csdn.net/insanegtp/article/details/78893088

问题(3)

CUDA cudnn这一块出现错误了‘’/sbin/ldconfig.real: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.4 不是符号连接‘’

解决办法:参考博客https://blog.csdn.net/langb2014/article/details/54376716

问题(4)

collect2: error: ld returned 1 exit status

modules/viz/CMakeFiles/opencv_test_viz.dir/build.make:236: recipe for target 'bin/opencv_test_viz' failed

make[2]: *** [bin/opencv_test_viz] Error 1

CMakeFiles/Makefile2:3306: recipe for target 'modules/viz/CMakeFiles/opencv_test_viz.dir/all' failed

make[1]: *** [modules/viz/CMakeFiles/opencv_test_viz.dir/all] Error 2

Makefile:160: recipe for target 'all' failed

make: *** [all] Error 2

解决方式:

sudo apt-get autoremove libtiff5-dev

sudo apt-get install libtiff5-dev

https://*.com/questions/38729954/error-installing-opencv-on-ubuntu-16-04

问题(5)期间安装过opencv3.4.1 安装完成后无法编译darknet出现一些C C++兼容性的问题,因此卸载了重新安装opencv3.4.0

https://github.com/opencv/opencv/issues/10963(讨论网址)