错误在Debian上编译OpenCV(C ++)

时间:2019-01-26 10:03:10

标签: c++ opencv

[  9%] Built target libwebp
[ 15%] Built target IlmImf
[ 17%] Built target ippiw
[ 23%] Built target libprotobuf
[ 24%] Built target quirc
[ 24%] Built target ittnotify
[ 24%] Built target opencv_test_core_pch_dephelp
[ 24%] Built target opencv_core_pch_dephelp
[ 24%] Built target opencv_ts_pch_dephelp
[ 24%] Built target pch_Generate_opencv_ts
[ 24%] Built target pch_Generate_opencv_core
make[2]: Warning: File '/usr/lib/x86_64-linux-gnu/libz.so' has modification time 2220 s in the future
[ 24%] Linking CXX shared library ../../lib/libopencv_core.so
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
[ 31%] Built target opencv_core
[ 31%] Built target opencv_imgproc_pch_dephelp
[ 31%] Built target pch_Generate_opencv_imgproc
[ 31%] Linking CXX shared library ../../lib/libopencv_imgproc.so
[ 37%] Built target opencv_imgproc
[ 37%] Built target opencv_imgcodecs_pch_dephelp
[ 37%] Built target pch_Generate_opencv_imgcodecs
make[2]: Warning: File '/usr/lib/x86_64-linux-gnu/libz.so' has modification time 2217 s in the future
[ 37%] Linking CXX shared library ../../lib/libopencv_imgcodecs.so
make[2]: warning:  Clock skew detected.  Your build may be incomplete.
[ 39%] Built target opencv_imgcodecs
[ 39%] Built target opencv_videoio_pch_dephelp
[ 39%] Built target pch_Generate_opencv_videoio
[ 39%] Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libavcodec.a(vc1dsp_mmx.o): relocation R_X86_64_PC32 against symbol `ff_pw_9' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/build.make:231: lib/libopencv_videoio.so.4.0.1] Error 1
make[1]: *** [CMakeFiles/Makefile2:3712: modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [Makefile:163: all] Error 2

当我尝试使用“ make”命令编译OpenCV时,总是会出现这些错误。我尝试过OpenCV 3.4.5 4.0.1,并且我已经安装了OpenCV所需的所有库。

1 个答案:

答案 0 :(得分:1)

您当前的日期和时间有问题

  • 具有类似Warning: File '/usr/lib/x86_64-linux-gnu/libz.so' has modification time 2220 s in the future的关于标准库的消息

  • 通过消息“警告:检测到时钟偏斜。您的版本可能不完整。” 您可以看到,您打扰 make ,因为它使用了日期和时间。是否重新编译(即使在您的情况下也可能全部编译,因为还没有完成对象/库)

因此,您确实需要更新操作系统上的日期和时间,并激活 ntp

  

/ usr / bin / ld:/usr/local/lib/libavcodec.a(vc1dsp_mmx.o):制作共享库时,不能使用符号'ff_pw_9'来重定位R_X86_64_PC32;用-fPIC重新编译”

Makefile是通过 configure 生成的,以具有正确的编译器选项,看来您需要修改 configure.in 来添加-fPIC

很难说更多,因为您甚至没有指出您的linux /其他操作系统发行版...