尝试制作时出现opencv安装错误

时间:2012-03-28 06:08:58

标签: ubuntu opencv installation

我的系统是Ubuntu 11.10。

我一直在遵循这个指南: http://www.ozbotz.org/opencv-installation/

我还修复了一些错误(因为我安装了最新的ffmpeg 0.10.2): http://code.opencv.org/issues/1605

然而,当我尝试做一个make时,我得到3个错误都是基于我从上面的问题链接做的修复。特别是:

cap_ffmpeg_impl.hpp:1485:32: error: ‘av_format_write_header’ was not declared in this scope

cap_ffmpeg_impl.hpp:524:64: error: too many arguments to function ‘int avformat_open_input(AVFormatContext**, const char*, AVInputFormat*, AVDictionary**)’

cap_ffmpeg_impl.hpp:486:53: error: too many arguments to function ‘int avformat_open_input(AVFormatContext**, const char*, AVInputFormat*, AVDictionary**)’

这是我的cmake:

blanket@comp:~/Downloads/OpenCV-2.3.1/build$ cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detected version of GNU GCC: 46 (406)
-- checking for module 'gtk+-2.0'
--   found gtk+-2.0, version 2.24.6
-- checking for module 'gthread-2.0'
--   found gthread-2.0, version 2.30.0
-- checking for module 'gstreamer-base-0.10'
--   found gstreamer-base-0.10, version 0.10.35
-- checking for module 'gstreamer-app-0.10'
--   found gstreamer-app-0.10, version 0.10.35
-- checking for module 'gstreamer-video-0.10'
--   found gstreamer-video-0.10, version 0.10.35
-- checking for module 'libavcodec'
--   found libavcodec, version 54.12.100
-- checking for module 'libavformat'
--   found libavformat, version 54.3.100
-- checking for module 'libavutil'
--   found libavutil, version 51.44.100
-- checking for module 'libswscale'
--   found libswscale, version 2.1.100
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- checking for module 'libdc1394-2'
--   package 'libdc1394-2' not found
-- checking for module 'libdc1394'
--   package 'libdc1394' not found
-- Found ZLIB: /usr/lib/i386-linux-gnu/libz.so (found version "1.2.3.4")
-- Found PNG: /usr/lib/i386-linux-gnu/libpng.so 
-- Looking for /usr/include/png.h
-- Looking for /usr/include/png.h - found
-- Looking for /usr/include/libpng/png.h
-- Looking for /usr/include/libpng/png.h - found
-- Found TIFF: /usr/lib/i386-linux-gnu/libtiff.so 
-- Found JPEG: /usr/lib/i386-linux-gnu/libjpeg.so 
-- Found Jasper: /usr/lib/i386-linux-gnu/libjasper.so 
-- Looking for alloca.h
-- Looking for alloca.h - found
-- Looking for alloca
-- Looking for alloca - not found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- checking for module 'libv4l1'
--   found libv4l1, version 0.8.6
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Found PythonInterp: /usr/bin/python2.7 
-- Could NOT find PythonLibs (missing:  PYTHON_INCLUDE_DIRS) 
--     Use NumPy headers from: /usr/lib/pymodules/python2.7/numpy/core/include
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named sphinx
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing:  CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "4.0")
-- Parsing 'cvconfig.h.cmake'
-- 
-- General configuration for opencv 2.3.1 =====================================
-- 
--     Built as dynamic libs?:     YES
--     Compiler:                   /usr/bin/c++
--     C++ flags (Release):          -Wall -pthread -march=i686 -ffunction-sections  -O3 -DNDEBUG  -fomit-frame-pointer -msse -msse2 -mfpmath=387 -DNDEBUG 
--     C++ flags (Debug):            -Wall -pthread -march=i686 -ffunction-sections  -g  -O0 -DDEBUG -D_DEBUG -ggdb3 
--     Linker flags (Release):      
--     Linker flags (Debug):        
-- 
--   GUI: 
--     GTK+ 2.x:                   YES
--     GThread:                    YES
-- 
--   Media I/O: 
--     ZLib:                       YES
--     JPEG:                       TRUE
--     PNG:                        TRUE
--     TIFF:                       TRUE
--     JPEG 2000:                  TRUE
--     OpenEXR:                    NO
--     OpenNI:                     NO
--     OpenNI PrimeSensor Modules: NO
--     XIMEA:                      NO
-- 
--   Video I/O:
--     DC1394 1.x:                 NO
--     DC1394 2.x:                 NO
--     FFMPEG:                     YES
--       codec:                    YES
--       format:                   YES
--       util:                     YES
--       swscale:                  YES
--       gentoo-style:             YES
--     GStreamer:                  YES
--     UniCap:                     NO
--     PvAPI:                      NO
--     V4L/V4L2:                   Using libv4l
--     Xine:                       NO
-- 
--   Other third-party libraries:
--     Use IPP:                    NO
--     Use TBB:                    NO
--     Use ThreadingFramework:     NO
--     Use Cuda:                   NO
--     Use Eigen:                  NO
-- 
--   Interfaces:
--     Python:                     YES
--     Python interpreter:         /usr/bin/python2.7 -B (ver 2.7)
--     Python numpy:               YES
--     Java:                       NO
-- 
--   Documentation:
--     Sphinx:                     NO
--     PdfLaTeX compiler:          NO
--     Build Documentation:        NO
-- 
--   Tests and samples:
--     Tests:                      YES
--     Examples:                   NO
-- 
--   Install path:                 /usr/local
-- 
--   cvconfig.h is in:             /home/blanket/Downloads/OpenCV-2.3.1/build
-- -----------------------------------------------------------------
-- 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/blanket/Downloads/OpenCV-2.3.1/build

以下是我的错误:

[ 21%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o
In file included from /home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘void CvCapture_FFMPEG::close()’:
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:451:9: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1517) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:451:31: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1517) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::reopen()’:
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:483:5: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1517) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:483:27: warning: ‘void av_close_input_file(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1517) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:486:53: error: too many arguments to function ‘int avformat_open_input(AVFormatContext**, const char*, AVInputFormat*, AVDictionary**)’
/usr/local/include/libavformat/avformat.h:1319:5: note: declared here
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:487:5: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1341) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:487:27: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1341) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:497:5: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3722) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:497:28: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3722) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvCapture_FFMPEG::open(const char*)’:
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:524:64: error: too many arguments to function ‘int avformat_open_input(AVFormatContext**, const char*, AVInputFormat*, AVDictionary**)’
/usr/local/include/libavformat/avformat.h:1319:5: note: declared here
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:529:11: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1341) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:529:33: warning: ‘int av_find_stream_info(AVFormatContext*)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1341) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:550:13: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3722) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:550:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3722) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘AVStream* icv_add_video_stream_FFMPEG(AVFormatContext*, CodecID, int, int, int, double, int)’:
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:999:7: warning: ‘AVStream* av_new_stream(AVFormatContext*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1541) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:999:26: warning: ‘AVStream* av_new_stream(AVFormatContext*, int)’ is deprecated (declared at /usr/local/include/libavformat/avformat.h:1541) [-Wdeprecated-declarations]
In file included from /home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In function ‘int icv_av_write_frame_FFMPEG(AVFormatContext*, AVStream*, uint8_t*, uint32_t, AVFrame*)’:
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1121:20: warning: ‘int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4042) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1121:72: warning: ‘int avcodec_encode_video(AVCodecContext*, uint8_t*, int, const AVFrame*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:4042) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp: In member function ‘bool CvVideoWriter_FFMPEG::open(const char*, int, double, int, int, bool)’:
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1442:15: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3722) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1442:36: warning: ‘int avcodec_open(AVCodecContext*, AVCodec*)’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:3722) [-Wdeprecated-declarations]
/home/blanket/Downloads/OpenCV-2.3.1/modules/highgui/src/cap_ffmpeg_impl.hpp:1485:32: error: ‘av_format_write_header’ was not declared in this scope
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2

1 个答案:

答案 0 :(得分:1)

您的 FFMPEG版本太近无法使用OpenCV。显然,一些功能签名发生了变化,这就是破坏构建的原因。

我过去使用FFMPEG 0.5.x和0.6.x编译OpenCV,所以我建议你降级你的FFMPEG。