我尝试使用以下说明安装 opencv这里但我每次都会收到错误
Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavcodec.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:191: recipe for target 'lib/libopencv_videoio.so.3.0.0' failed
make[2]: *** [lib/libopencv_videoio.so.3.0.0] Error 1
CMakeFiles/Makefile2:4022: recipe for target 'modules/videoio/CMakeFiles/opencv_videoio.dir/all' failed
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
Makefile:133: recipe for target 'all' failed
make: *** [all] Error 2
当我运行时,cmake -D CMAKE_BUILD_TYPE=RELEASE ..
它显示一切正常,并且库已安装。可能发生什么情况?我该如何解决?
答案1
参考这个 StackOverflow 问题:在 Ubuntu 14.10 中安装 OpenCV
您可以根据 OpenCV 的需要,cmake
使用-D WITH_FFMPEG=OFF
或手动编译 FFmpeg 版本 9。