OpenCV 2.4.5使错误 [英] Opencv 2.4.5 make error
问题描述
我正在尝试在Ubuntu 12.04上安装opencv 2.4.5 我尝试按照 http://opencv.willowgarage.com/wiki/InstallGuide_Linux 上的步骤进行操作>
但是,当我到达make步骤时.我收到一个错误.我是linux新手.
错误是
Linking CXX shared library ../../lib/libopencv_highgui.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: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.5] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
请帮助!!!
看来ffmpeg是罪魁祸首.不知何故,它造成了一些问题.我按照所述说明卸载了ffmpeg并安装了OpenCV.现在我已经安装了不支持FFMPEG的OpenCV 2.4.5.但至少它能正常工作!
我按照 http://www.ozbotz.org/opencv-installation/上的说明进行操作
现在已正确安装OpenCV 2.4.5.我使用的是64位Ubuntu 12.04,因为lib264和ffmpeg编译命令中缺少--enable-shared --enable-pic参数,所以抛出了问题中提到的错误.
按照这些说明解决了问题.
I am trying to install opencv 2.4.5 on Ubuntu 12.04 I tried following the steps on http://opencv.willowgarage.com/wiki/InstallGuide_Linux
However when I reach the make step. I am getting an error. I am new to linux.
The error is
Linking CXX shared library ../../lib/libopencv_highgui.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: could not read symbols: Bad value
collect2: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.5] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
Please help!!!
It seems ffmpeg was the culprit. Somehow it was creating some issues. I uninstalled ffmpeg and installed OpenCV following the instructions mentioned. Now I have OpenCV 2.4.5 installed without FFMPEG support. But atleast it is working!
Edit:
I followed the instructions on http://www.ozbotz.org/opencv-installation/
OpenCV 2.4.5 is now installed correctly. I am on 64bit Ubuntu 12.04 Since --enable-shared --enable-pic parameters were missing in the lib264 and ffmpeg compilation commands, the error as mentioned in the question was thrown.
Following those instructions solved the problem.
这篇关于OpenCV 2.4.5使错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!