Reputation: 735
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!!!
Upvotes: 2
Views: 5500
Reputation: 735
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.
Upvotes: 5
Reputation:
GCC:
$ sudo apt-get update
$ sudo apt-get install build-essential
Use later versions if available (Make sure you get the right version for your hardware and OS though)
Cmake:
http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
$ tar -xf cmake-2.8.10.2.tar.gz
$ cd cmake-2.8.10.2
$ ./configure
$ make -j4
$ sudo make install
Opencv: http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.3/OpenCV-2.4.3.tar.bz2/download
$ tar -xf OpenCV-2.4.3.tar.bz2
$ cd OpenCV-2.4.3
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=Release ..
$ make -j4
$ sudo make install
Upvotes: 1