【问题标题】:failure in compiling opencv with cap_gstreamer error使用 cap_gstreamer 错误编译 opencv 失败
【发布时间】:2017-03-04 19:41:15
【问题描述】:

我正在尝试在 Slackware 4.1 上编译 opencv。但是我每次都遇到以下错误。

In file included from /usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:29:0,
             from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:35:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererStreamInfoClass;

/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:83:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererContainerInfoClass;

/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:104:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererAudioInfoClass;
     ^
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:129:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererVideoInfoClass;
     ^
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:159:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererSubtitleInfoClass;
     ^
/usr/include/gstreamer-0.10/gst/pbutils/gstdiscoverer.h:202:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstDiscovererInfoClass;
     ^
In file included from /tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:65:0:
/usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:47:9: error: 'GstMiniObjectClass' does not name a type
typedef GstMiniObjectClass GstEncodingProfileClass;
     ^
/usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:66:9: error: 'GstEncodingProfileClass' does not name a type
typedef GstEncodingProfileClass GstEncodingContainerProfileClass;
     ^
/usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:85:9: error: 'GstEncodingProfileClass' does not name a type
typedef GstEncodingProfileClass GstEncodingVideoProfileClass;
     ^
/usr/include/gstreamer-0.10/gst/pbutils/encoding-profile.h:104:9: error: 'GstEncodingProfileClass' does not name a type
typedef GstEncodingProfileClass GstEncodingAudioProfileClass;
     ^
/tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp: In member function 'virtual bool CvCapture_GStreamer::grabFrame()':
/tmp/SBo/opencv-2.4.11/modules/highgui/src/cap_gstreamer.cpp:232:57: error: 'gst_app_sink_pull_sample' was not declared in this scope
 sample = gst_app_sink_pull_sample(GST_APP_SINK(sink));
                                                     ^
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_gstreamer.cpp.o] Error 1

编译配置报告如下:

-- General configuration for OpenCV 2.4.11 =====================================
--   Version control:               unknown
-- 
--   Platform:
--     Host:                        Linux 3.10.17 i686
--     CMake:                       2.8.12
--     CMake generator:             Unix Makefiles
--     CMake build tool:            /usr/bin/gmake
--     Configuration:               Release
-- 
--   C/C++:
--     Built as dynamic libs?:      YES
--     C++ Compiler:                /usr/bin/c++  (ver 4.8.2)
--     C++ flags (Release):         -O2 -march=i486 -mtune=i686   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -ffunction-sections -O2 -DNDEBUG  -DNDEBUG
--     C++ flags (Debug):           -O2 -march=i486 -mtune=i686   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
--     C Compiler:                  /usr/bin/cc
--     C flags (Release):           -O2 -march=i486 -mtune=i686   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -ffunction-sections -O2 -DNDEBUG  -DNDEBUG
--     C flags (Debug):             -O2 -march=i486 -mtune=i686   -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -march=i686 -fomit-frame-pointer -msse -msse2 -msse3 -mfpmath=sse -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
--     Linker flags (Release):      
--     Linker flags (Debug):        
--     Precompiled headers:         NO
-- 
--   OpenCV modules:
--     To be built:                 core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib stitching superres ts videostab
--     Disabled:                    world
--     Disabled by dependency:      -
--     Unavailable:                 androidcamera dynamicuda java python viz
-- 
--   GUI: 
--     QT 4.x:                      YES (ver 4.8.5 EDITION = OpenSource)
--     QT OpenGL support:           NO
--     OpenGL support:              NO
--     VTK support:                 NO
-- 
--   Media I/O: 
--     ZLib:                        /usr/lib/libz.so (ver 1.2.8)
--     JPEG:                        /usr/lib/libjpeg.so (ver 80)
--     PNG:                         /usr/lib/libpng.so (ver 1.4.12)
--     TIFF:                        /usr/lib/libtiff.so (ver 42 - 3.9.7)
--     JPEG 2000:                   build (ver 1.900.1)
--     OpenEXR:                     build (ver 1.7.1)
-- 
--   Video I/O:
--     DC1394 1.x:                  NO
--     DC1394 2.x:                  YES (ver 2.2.2)
--     FFMPEG:                      NO
--       codec:                     NO
--       format:                    NO
--       util:                      NO
--       swscale:                   NO
--       gentoo-style:              NO
--     GStreamer:                   
--       base:                      YES (ver 0.10.36)
--       video:                     YES (ver 0.10.36)
--       app:                       YES (ver 0.10.36)
--       riff:                      YES (ver 0.10.36)
--       pbutils:                   YES (ver 0.10.36)
--     OpenNI:                      NO
--     OpenNI PrimeSensor Modules:  NO
--     PvAPI:                       NO
--     GigEVisionSDK:               NO
--     UniCap:                      NO
--     UniCap ucil:                 NO
--     V4L/V4L2:                    Using libv4l1 (ver 0.9.5) / libv4l2 (ver 0.9.5)
--     XIMEA:                       NO
--     Xine:                        NO
-- 
--   Other third-party libraries:
--     Use IPP:                     NO
--     Use Eigen:                   NO
--     Use TBB:                     NO
--     Use OpenMP:                  NO
--     Use GCD                      NO
--     Use Concurrency              NO
--     Use C=:                      NO
--     Use Cuda:                    NO
--     Use OpenCL:                  YES
-- 
--   OpenCL:
--     Version:                     dynamic
--     Include path:                /tmp/SBo/opencv-2.4.11/3rdparty/include/opencl/1.2
--     Use AMD FFT:                 NO
--     Use AMD BLAS:                NO
-- 
--   Python:
--     Interpreter:                 /usr/bin/python2 (ver 2.7.5)
-- 
--   Java:
--     ant:                         NO
--     JNI:                         /usr/lib/java/include /usr/lib/java/include/linux /usr/lib/java/include
--     Java tests:                  NO
-- 
--   Documentation:
--     Build Documentation:         NO
--     Sphinx:                      NO
--     PdfLaTeX compiler:           /usr/share/texmf/bin/pdflatex
--     Doxygen:                     YES (/usr/bin/doxygen)
-- 
--   Tests and samples:
--     Tests:                       YES
--     Performance tests:           YES
--     C/C++ Examples:              NO
-- 
--   Install path:                  /usr
-- 
--   cvconfig.h is in:              /tmp/SBo/opencv-2.4.11/build

我从下面的链接查看了 opencv 要求

http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation

我需要 ffmpeg 或 libav 包,在标准 slackware 14.1 包中找不到。但是我完全安装了gstreamer(gstreamer、gst-pluigns-base和good),我上面遇到的错误肯定和gstreamer有关。

【问题讨论】:

    标签: c++ opencv gstreamer


    【解决方案1】:

    我通过安装libgstreamer-plugins-base1.0-dev 解决了这个问题。在此之前 CMake 检测到 GStreamer 版本 0.10.36,之后 - 1.4.5。

    【讨论】:

      【解决方案2】:

      在我将 WITH_GSTREAMER_0_10 设置为 ON 后它对我有用

      【讨论】:

      • 这很好用并且不会禁用 gstreamer,正如其他答案所建议的那样......也不知道为什么它被否决了。
      • 我也可以使用这个选项安装 opencv。很好的答案
      【解决方案3】:

      我使用的是 Ubuntu 12.04,但遇到了同样的错误。 这可以通过使用 -D WITH_GSTREAMER=OFF 参数来避免。 根据herehere 的建议。

      然后here 他们建议更新 gstreamer,但这并没有为我解决。 我仍然想通过全新安装来验证这一点。

      【讨论】:

      • 看起来 OP 想要 gstreamer...为什么建议禁用它?
      【解决方案4】:

      如果有人对此仍有疑问, 尝试使用所有软件包正确安装 gstreamer1.0

      Fedora 操作系统示例:

      dnf install gstreamer1-devel gstreamer1-plugins-base-tools 
      gstreamer1-devel-docs gstreamer1-plugins-base-devel 
      gstreamer1-plugins-base-devel-docs 
      gstreamer1-plugins-good gstreamer1-plugins-good-extras 
      gstreamer1-plugins-ugly gstreamer1-plugins-ugly-devel-docs  
      gstreamer1-plugins-bad-free gstreamer1-plugins-bad-free-devel
      gstreamer1-plugins-bad-free-extras
      

      这里是您系统的综合安装指南:official link.

      【讨论】:

        猜你喜欢
        • 2011-12-21
        • 1970-01-01
        • 2014-03-14
        • 2014-06-01
        • 2014-06-03
        • 2018-02-20
        • 1970-01-01
        • 1970-01-01
        • 2020-12-05
        相关资源
        最近更新 更多