ubuntu14.04 配置opencv249种种问题记录
2015-04-10 16:59
387 查看
首先如果你的运气足够好,你完全可以按照 :
http://blog.csdn.net/codeforces_sphinx/article/details/8246546
或者opencv中文论坛上的linux下opencv的安装方法
但是我的运气不好,上述两种方法安装不了,参考这个:点击打开链接
我把过程分析如下.
由于opencv的cmakelist里依赖一些库,所有要先配置好这些库,我主要是被ffmpeg和x264 玩死了快: 保险起见,先去除你电脑上的这些重新装.
安装其他依赖库.
安装gstreamer,主要是opencv里头的相机模块用到
安装,接着安装
安装 install x264.
Download a recent stable snapshot of x264 from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/. The exact version does not seem to matter. To write this guide, I used version x264-snapshot-20120528-2245-stable.tar.bz2, but I have used previous versions too.
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120528-2245-stable.tar.bz2
tar xvf x264-snapshot-20120528-2245-stable.tar.bz2
PS:由于我的电脑是64,所以要加上
安装ffmpeg
Download ffmpeg version 1.2 from http://ffmpeg.org/download.html.PS:装ffmpeg-0.11.1编译不通过,报错: /usr/local/lib/libswscale.a(swscale_unscaled.o): relocation R_X86_64_32S against `av_pix_fmt_descriptors@@LIBAVUTIL_52' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libswscale.a: error adding symbols: 错误的值
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.9] 错误 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] 错误 2
make: *** [all] 错误 2
猜可能是opencv249依赖的ffmpeg版本不对照
安装v4l (video for linux) from http://www.linuxtv.org/downloads/v4l-utils/.
wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-1.0.0.tar.bz2
安装OpenCV 2.4.9.
Download OpenCV version 2.4.2 from http://sourceforge.net/projects/opencvlibrary/files/
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/OpenCV-2.4.9.tar.bz2
Create a new build directory and run cmake:
Verify that the output of cmake includes the following text:
found gstreamer-base-0.10
GTK+ 2.x: YES
FFMPEG: YES
GStreamer: YES
V4L/V4L2: Using libv4l
Build and install OpenCV.
Configure Linux.
Tell linux where the shared libraries for OpenCV are located by entering the following shell command:
Add the command to your .bashrc file so that you don’t have to enter every time your start a new terminal.
Alternatively, you can configure the system wide library search path. Using your favorite editor, add a single line containing the text
After editing the opencv.conf file, enter the following command:
.
Using your favorite editor, add the following two lines to the end of /etc/bash.bashrc:
就这样吧.....最好按照步骤来,先装好依赖库再搞别的
http://blog.csdn.net/codeforces_sphinx/article/details/8246546
或者opencv中文论坛上的linux下opencv的安装方法
但是我的运气不好,上述两种方法安装不了,参考这个:点击打开链接
我把过程分析如下.
由于opencv的cmakelist里依赖一些库,所有要先配置好这些库,我主要是被ffmpeg和x264 玩死了快: 保险起见,先去除你电脑上的这些重新装.
sudo apt-get remove ffmpeg x264 libx264-dev
安装其他依赖库.
sudo apt-get update sudo apt-get install build-essential checkinstall git cmake libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev
安装gstreamer,主要是opencv里头的相机模块用到
sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg
安装,接着安装
sudo apt-get install libgtk2.0-0 libgtk2.0-dev
sudo apt-get install libjpeg8 libjpeg8-dev
安装 install x264.
Download a recent stable snapshot of x264 from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/. The exact version does not seem to matter. To write this guide, I used version x264-snapshot-20120528-2245-stable.tar.bz2, but I have used previous versions too.
cd ~/src
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120528-2245-stable.tar.bz2
tar xvf x264-snapshot-20120528-2245-stable.tar.bz2
cd x264-snapshot-20120528-2245-stable
./configure--enable-shared --enable-pic
make sudo make install
PS:由于我的电脑是64,所以要加上
--enable-shared --enable-pic,否则就会报错:
[code]/usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet' can not be used when making a shared object;
recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
安装ffmpeg
Download ffmpeg version 1.2 from http://ffmpeg.org/download.html.PS:装ffmpeg-0.11.1编译不通过,报错: /usr/local/lib/libswscale.a(swscale_unscaled.o): relocation R_X86_64_32S against `av_pix_fmt_descriptors@@LIBAVUTIL_52' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libswscale.a: error adding symbols: 错误的值
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.9] 错误 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] 错误 2
make: *** [all] 错误 2
猜可能是opencv249依赖的ffmpeg版本不对照
cd ~/src wget http://ffmpeg.org/releases/ffmpeg-1.2.tar.bz2 tar xvf ffmpeg-1.2.tar.bz2 cd ffmpeg-1.2
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-pic
make sudo make install
安装v4l (video for linux) from http://www.linuxtv.org/downloads/v4l-utils/.
报错:dvb-v5.h:69:9: error: ‘NULL’ undeclared here ........原因是v4l的版本不对,于是我装了v4l 1.0.0
wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-1.0.0.tar.bz2
tar xvf v4l-utils-1.0.0.tar.bz2
cd v4l-utils1.0.0
make sudo make install
安装OpenCV 2.4.9.
Download OpenCV version 2.4.2 from http://sourceforge.net/projects/opencvlibrary/files/
cd ~/src
wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.9/OpenCV-2.4.9.tar.bz2
tar xvf OpenCV-2.4.9.tar.bz2
Create a new build directory and run cmake:
cd OpenCV-2.4.9/ mkdir build cd build cmake -D CMAKE_BUILD_TYPE=RELEASE ..
Verify that the output of cmake includes the following text:
found gstreamer-base-0.10
GTK+ 2.x: YES
FFMPEG: YES
GStreamer: YES
V4L/V4L2: Using libv4l
Build and install OpenCV.
make sudo make install
Configure Linux.
Tell linux where the shared libraries for OpenCV are located by entering the following shell command:
export LD_LIBRARY_PATH=/usr/local/lib
Add the command to your .bashrc file so that you don’t have to enter every time your start a new terminal.
Alternatively, you can configure the system wide library search path. Using your favorite editor, add a single line containing the text
/usr/local/libto the end of a file named
/etc/ld.so.conf.d/opencv.conf. In the standard Ubuntu install, the opencv.conf file does not exist; you need to create it. Using vi, for example, enter the following commands:
sudo vi /etc/ld.so.conf.d/opencv.conf G o /usr/local/lib <Esc> :wq!
After editing the opencv.conf file, enter the following command:
sudo ldconfig /etc/ld.so.conf
.
Using your favorite editor, add the following two lines to the end of /etc/bash.bashrc:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH
就这样吧.....最好按照步骤来,先装好依赖库再搞别的
相关文章推荐
- Ubuntu14.04配置问题记录
- opencv 以及opencv_contrib ubuntu14.04 配置的问题汇总
- 基于14.04 ubuntu 配置 eclipse 为opencv 常见问题解决 第三篇
- 记录下Ubuntu14.04+opencv2.4.13+Qt4/Qt5+Opengl环境搭建遇到的问题
- ubuntu 14.04 +Kinect+ openNI+ openCV+ Sensorkinect 配置 +获取深度图像及相关问题
- Ubuntu14.04+cuda6.5+opencv2.4.9+caffe配置记录
- ubuntu server14.04LTS下手动模拟DNS并配置虚拟主机以及配置过程遇到的问题的解决方法
- opencv 在 ubuntu14.04 中的配置和测试
- ubuntu 14.04 环境配置及某些问题
- 彻底解决Ubuntu 14.04 重启后DNS配置丢失的问题
- caffe+cuda7.0+opencv3.0.0+mkl ubuntu14.04配置
- 喝一杯咖啡真难——我的caffe在ubuntu14.04下安装配置,改错,换包记录
- Hadoop linux(ubuntu)分布式部署配置问题记录
- 点滴记录——Ubuntu 14.04中gedit打开文件出现中文乱码问题
- ubuntu14.04 虚拟机安装opencv2.4.10,make遇到的问题
- 彻底解决Ubuntu 14.04 重启后DNS配置丢失的问题
- Ubuntu 14.04 待机死机问题原来是自己改了这个配置
- Ubuntu14.04 QtCreator中配置OpenCV
- ubuntu14.04上Trac配置记录
- ubuntu14.04安装DevStack与遇到的的问题记录