OpenCV Ubuntu安装错误

时间:2015-02-26 21:16:54

标签: opencv ubuntu-14.10

我试图在Ubuntu 14.10上安装OpenCV,但我一次又一次地面对这个错误:(

    /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/highgui/CMakeFiles/opencv_highgui.dir/build.make:654: recipe for target 'lib/libopencv_highgui.so.2.4.9' failed
    make[2]: *** [lib/libopencv_highgui.so.2.4.9] Error 1
    CMakeFiles/Makefile2:1767: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed
    make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
    Makefile:133: recipe for target 'all' failed
    make: *** [all] Error 2

2 个答案:

答案 0 :(得分:0)

请在遇到错误之前提供命令历史记录。

如果在发生错误之前调用make是最后一件事,您可以尝试拨打make CFLAGS="-fPIC"

答案 1 :(得分:0)

晚会,但问题是FFMPEG没有编译与位置无关的代码。转到FFMPEG目录并执行

./configure --enable-nonfree --enable-pic --enable-shared

然后重做makemake install步骤,并重新执行opencv的构建。