I just can't install OpenCV on Ubuntu 10.04 x86_64
Hi all I am trying to install opencv on a ubuntu 10.04 x86_64. I followed these instructions link text but when I run make I got this message
> make [ 0%]
> Built target opencv_core_pch_dephelp [ 0%]
> Built target pch_Generate_opencv_core [ 3%]
> Built target opencv_core [ 4%]
> Built target opencv_ts_pch_dephelp [ 4%]
> Built target pch_Generate_opencv_ts [ 4%]
> Built target opencv_imgproc_pch_dephelp [ 4%]
> Built target pch_Generate_opencv_imgproc [ 9%]
> Built target opencv_imgproc [ 9%]
> Built target opencv_flann_pch_dephelp [ 9%]
> Built target pch_Generate_opencv_flann [ 9%]
> Built target opencv_flann [ 9%]
> Built target opencv_highgui_pch_dephelp [ 9%]
> Built target pch_Generate_opencv_highgui
> 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
I am having a similar problem on Ubuntu 13.04 x86_64. My exact error is:
Linking CXX shared library ../../lib/libopencv_highgui.so /usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet_nofree' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libavcodec.a: could not read symbols: Bad value
how do you think to fix it? I'm desperate
Don't build with avcodec support, try to remove libavcodec if you don't really need it. it seems to be the blocker. apt-get purge libavcodec-*
I uninstalled libavcodec $ sudo apt-get remove libavcodec-dev libavcodec-extra-52 libavcodec-unstripped-52 libavcodec52
Reading package lists... Done Building dependency tree
Reading state information... Done Package libavcodec-dev is not installed, so not removed Package libavcodec-extra-52 is not installed, so not removed Package libavcodec-unstripped-52 is not installed, so not removed Package libavcodec52 is not installed, so not removed 0 upgraded, 0 newly installed, 0 to remove and 310 not upgraded.
then I checked /usr/local/lib $ ls /usr/local/lib/libavls: cannot access /usr/local/lib/libav: No such file or directory
But still it doesn't work... It seems to need avcodec! $ make [ 0%] Built target opencv_core_pch_dephelp [ 0%] Built target pch_Generate
[ 0%] Built target pch_Generate_opencv_core [ 3%] Built target opencv_core [ 4%] Built target opencv_ts_pch_dephelp [ 4%] Built target pch_Generate_opencv_ts [ 4%] Built target opencv_imgproc_pch_dephelp [ 4%] Built target pch_Generate_opencv_imgproc [ 9%] Built target opencv_imgproc [ 9%] Built target opencv_flann_pch_dephelp [ 9%] Built target pch_Generate_opencv_flann [ 9%] Built target opencv_flann [ 9%] Built target opencv_highgui_pch_dephelp [ 9%] Built target pch_Generate_opencv_highgui Linking CXX shared library ../../lib/libopencv_highgui.so /usr/bin/ld: cannot find -lavcodec
Linking CXX shared library ../../lib/libopencv_highgui.so /usr/bin/ld: cannot find -lavcodec 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
After removing avcodec run cmake again. then make.
I did that but no luck. I removed avcodec, ran cmake, and then, make. I was still stuck on highgui. I'll like to know if anyone has got it installed and running on Ubuntu.
I did, It all went ver smooth, I compiled with java and opencl support, on ubuntu 12.04.
i removed libavcodec with $ sudo apt-get remove libavcodec* $ rm /usr/local/lib/libav* but still it doesn't wrk $ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. $ make ... [ 9%] Built target pch_Generate_opencv_highgui Linking CXX shared library ../../lib/libopencv_highgui.so /usr/bin/ld: cannot find -lavcodec 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