OpenCV2.3.1在Ubuntu11.10上编译错误解决方法
2011-11-26 21:53
302 查看
经过上次介绍Ubuntu
全新编译安装 OpenCV 2.3之后,很快,新的2.3.1又出来了,经不住诱惑,马上试试但是,不知道大家在编译最新的2.3.1的时候出现错误没,反正我出现错误了,具体编译错误如下:
配置下 x264 libraries:
OpenCV2.3.1 以及之前的版本需要 ffmpeg 0.7.x.
配置编译 ffmpeg:
编译v4l:
抄袭结束,由于编译OpenCV差不多,所以就不抄了。。。具体可参考我的Ubuntu
全新编译安装 OpenCV 2.3
或者上面提到的神级人物的http://ozbots.org/opencv-installation/
全新编译安装 OpenCV 2.3之后,很快,新的2.3.1又出来了,经不住诱惑,马上试试但是,不知道大家在编译最新的2.3.1的时候出现错误没,反正我出现错误了,具体编译错误如下:
[ 35%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o In file included from /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg.cpp:45:0: /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::reopen()’: /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:486:5: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:486:52: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:494:5: warning: ‘int avcodec_thread_init(AVCodecContext*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3611) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:494:50: warning: ‘int avcodec_thread_init(AVCodecContext*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3611) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::open(const char*)’: /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:524:15: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:524:63: warning: ‘int av_open_input_file(AVFormatContext**, const char*, AVInputFormat*, int, AVFormatParameters*)’ is deprecated (declared at /usr/include/libavformat/avformat.h:1050) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:541:9: warning: ‘int avcodec_thread_init(AVCodecContext*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3611) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:541:54: warning: ‘int avcodec_thread_init(AVCodecContext*, int)’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:3611) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:547:13: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::grabFrame()’: /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:640:34: error: ‘avcodec_decode_video’ was not declared in this scope /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘const char* icvFFMPEGErrStr(int)’: /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:917:10: error: ‘AVERROR_NUMEXPECTED’ was not declared in this scope /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:921:10: error: ‘AVERROR_NOFMT’ was not declared in this scope /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:923:10: error: ‘AVERROR_IO’ was not declared in this scope /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:925:10: error: ‘AVERROR_NOMEM’ was not declared in this scope /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, CodecID, int, int, int, double, int)’: /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:1012:70: error: ‘CODEC_TYPE_VIDEO’ was not declared in this scope In file included from /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg.cpp:45:0: /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvVideoWriter_FFMPEG::close()’: /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:1298:3: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/include/libavformat/avio.h:279) [-Wdeprecated-declarations] /home/xizhibei/OpenCV2.3.1/release/CMakeExternals/Source/OpenCV/modules/highgui/src/cap_ffmpeg_impl.hpp:1298:20: warning: ‘int url_fclose(AVIOContext*)’ is deprecated (declared at /usr/include/libavformat/avio.h:279) [-Wdeprecated-declarations]很明显,是ffmpeg的问题,在目前的Ubuntu下版本不够高,所以,我就开始一番查找,终于让我找到了一篇好文章:以下开始抄袭,抄袭地址在这:http://ozbots.org/opencv-installation/删掉这些旧的ffmpeg x264 libx264-dev:
sudo apt-get remove ffmpeg x264 libx264-dev下载x264和ffmpeg所有的依赖:
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:
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下载并安装x264.到ftp://ftp.videolan.org/pub/videolan/x264/snapshots/下载个最近的稳定版本snapshot of x264 .
配置下 x264 libraries:
./configure --enable-static make sudo make install下载安装 ffmpeg.到http://ffmpeg.org/download.html下载 ffmpeg version 0.8.x .(实际上,需要Git下载:git clonegit://source.ffmpeg.org/ffmpeg.git,这个好像比较快)注意:
OpenCV2.3.1 以及之前的版本需要 ffmpeg 0.7.x.
配置编译 ffmpeg:
./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 make sudo make install安装 gtk:
sudo apt-get install libgtk2.0-0 libgtk2.0-dev安装 libjpeg:
sudo apt-get install libjpeg62 libjpeg62-dev下载安装 v4l (video for linux).从http://www.linuxtv.org/downloads/v4l-utils/下载 v4l-utils-0.8.5.tar.bz2
编译v4l:
make sudo make install
抄袭结束,由于编译OpenCV差不多,所以就不抄了。。。具体可参考我的Ubuntu
全新编译安装 OpenCV 2.3
或者上面提到的神级人物的http://ozbots.org/opencv-installation/
相关文章推荐
- centos7 CMake编译opencv2.4.13/opencv3.0.0 SIZE_MAX 错误解决方法
- 采用MingW编译OPENCV,出现recipe for target xxx/can't create precompiled header错误解决方法
- cmake编译opencv2.2时,出现错误解决方法
- opencv3.1.0+cuda8.0+vs2013+win7编译过程错误及解决方法
- linux内核编译错误 No rule to make target menuconfig解决方法
- 编译全攻略-编译器处理及LNK错误的解决方法
- mplayer svn最新版在redhat9下编译发生的错误及解决方法
- VS编译链接时错误(Error Link2005)的解决方法
- 编译VTK6.1.0在vtkGUISupportQt-6.1.dll项上出现错误'GLdouble' : redefinition的解决方法
- Xcode6编译SDWebImage报错解决方法(SDWebImageDownloaderOperation.m错误)
- 关于编译ffmpeg的output-example.c和api-example.c 错误的一些解决方法
- OpenCV1.0编译错误解决办法
- LPDIRECTDRAW7编译错误的解决方法
- 分享以下编译错误:java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException的一种解决方法
- C++编译全攻略-编译器处理及LNK错误的解决方法(ZZ)
- 编译错误解决方法
- JNI编译时错误 编码GBK的不可映射字符 解决方法
- VS2013中编译项目在静态库中使用MFC出现错误的解决方法
- 在vs2010中编译log4cxx-0.10.0详细方法(从下载、编译、解决错误详细介绍)
- LINK2001 编译时_RTC_Shutdown和_RTC_InitBase相关错误的解决方法