Hi!!!
I'm running the following script to install OpenCV:
"> version="2.4.9" downloadfile="opencv-2.4.9.zip" dldir="/home/marcelo"
if [[ -z "$version" ]]; then
echo "Please define version before calling basename $0
or use a wrapper like opencv_latest.sh"
exit 1
fi
if [[ -z "$downloadfile" ]]; then
echo "Please define downloadfile before calling basename $0
or use a wrapper like opencv_latest.sh"
exit 1
fi
if [[ -z "$dldir" ]]; then
dldir=OpenCV
fi
echo "Installing OpenCV" $version
mkdir $dldir
cd $dldir
echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -qq remove ffmpeg x264 libx264-dev
echo "Installing Dependenices"
sudo apt-get -qq install libopencv-dev build-essential #checkinstall cmake pkg-config yasm libtiff4-dev libjpeg-dev #libjasper-dev libavcodec-dev libavformat-dev libswscale-dev #libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-#plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-#dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev #libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev #libvorbis-dev libxvidcore-dev x264 v4l-utils ffmpeg unzip
echo "Downloading OpenCV" $version
wget -O $downloadfile http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/$downloadfile/download
echo "Installing OpenCV" $version
echo $downloadfile | grep ".zip"
if [ $? -eq 0 ]; then
unzip $downloadfile
else
tar -xvf $downloadfile
fi
cd opencv-$version
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j 4
sudo make install
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig
echo "OpenCV" $version "ready to be used"
The script seems to be working fine, but at the end I get the following results:
"> [ 6%] Built target opencv_imgproc
[ 6%] Built target opencv_photo
[ 6%] Built target opencv_video
Linking CXX shared library ../../lib/libopencv_highgui.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libjpeg.a(jcapimin.o): relocation R_X86_64_32S against jpeg_natural_order' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libjpeg.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.9] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
[ 0%] Built target opencv_core_pch_dephelp
[ 0%] Built target pch_Generate_opencv_core
[ 3%] Built target opencv_core
[ 3%] Built target opencv_ts_pch_dephelp
[ 3%] Built target pch_Generate_opencv_ts
[ 3%] Built target opencv_flann_pch_dephelp
[ 3%] Built target pch_Generate_opencv_flann
[ 3%] Built target opencv_flann
[ 3%] Built target opencv_imgproc_pch_dephelp
[ 3%] Built target pch_Generate_opencv_imgproc
[ 6%] Built target opencv_imgproc
[ 6%] Built target opencv_features2d_pch_dephelp
[ 6%] Built target pch_Generate_opencv_features2d
[ 6%] Built target opencv_highgui_pch_dephelp
[ 6%] Built target pch_Generate_opencv_highgui
Linking CXX shared library ../../lib/libopencv_highgui.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libjpeg.a(jcapimin.o): relocation R_X86_64_32S against
jpeg_natural_order' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libjpeg.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: * [lib/libopencv_highgui.so.2.4.9] Error 1
make[1]: [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: ** [all] Error 2
OpenCV 2.4.9 ready to be used"
Now, even though that last line says "OpenCV 2.4.9 ready to be used", I have my doubts because the installation process log (as I said before, the lines I copied are the last ones) goes up to 6% and I guess it should keep going up to 100%, right? And since the log says "can not be used when making a shared object; recompile with -fPIC" I guess it's because I should re-compile in order for OpenCV to be working fine.
And mainly, I'm using OpenCV for another program which keeps crashing with the following error: "Wrong JPEG library version: library is 62, caller expects 80". Since I'm trying to find out what causes that error, I'm guessing I have some sort of issue with the jpeg library which might be causing errors too on my openCV installation. Could somebody please help me?