这是我的制作日志:
[ 3%] Built target libwebp
[ 3%] Built target opencv_cudev
[ 7%] Built target opencv_ts_pch_dephelp
[ 7%] Built target pch_Generate_opencv_ts
[ 7%] Built target opencv_core_pch_dephelp
[ 7%] Built target pch_Generate_opencv_core
[ 11%] Built target opencv_core
[ 11%] Built target opencv_imgproc_pch_dephelp
[ 11%] Built target pch_Generate_opencv_imgproc
[ 15%] Built target opencv_imgproc
[ 15%] Built target opencv_imgcodecs_pch_dephelp
[ 15%] Built target pch_Generate_opencv_imgcodecs
[ 15%] Built target opencv_imgcodecs
[ 15%] Built target opencv_videoio_pch_dephelp
[ 15%] Built target pch_Generate_opencv_videoio
Linking CXX shared library ../../lib/libopencv_videoio.so
/usr/bin/ld: /usr/local/lib/libavformat.a(rmsipr.o): relocation R_X86_64_32 against `.rodata' 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
make[2]: *** [lib/libopencv_videoio.so.3.0.0] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2
我尝试从源代码重新构建ffmpeg,在开始时,make ffmpeg遇到类似的问题,但在使用此命令配置后:
./configure --prefix=.. --enable-shared --enable-gpl --enable-version3 --enable-runtime-cpudetect --disable-outdev=sdl --disable-opencl --enable-libmp3lame --enable-libx264 --cc="gcc -m64 -fPIC" --extra-cflags="-I../include" --extra-ldflags="-L../lib -ldl"
建立了ffmpeg。
但opencv make错误仍然存在..
搜索了很多,找不到解决方案。
答案 0 :(得分:0)
基本上根据这篇文章重新制作x264和ffmpeg:http://www.ozbotz.org/opencv-installation-2-3-1/(记得在配置x264和ffmpeg时添加--enable-shared)将解决这个问题。