【问题标题】:OpenCV 2.4.11 Compilation For ROS ORB_SLAM2 FailsROS ORB_SLAM2 的 OpenCV 2.4.11 编译失败
【发布时间】:2021-05-12 15:50:49
【问题描述】:

我正在尝试编译 orb_slam2_ros,它需要高于 2.3 的 OpenCV 版本。我有 4.2.0 但它不起作用,但根据 ROS,它已经过测试可以在 2.4.11 上运行。这是我所做的:

  • 下载源 zip 文件。
  • 解压。
  • 进入目录并创建一个构建文件夹。
  • 进入构建文件夹并运行cmake ..。 有给我这个:

    CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:85 (list):
      list GET given empty list
    Call Stack (most recent call first):
      CMakeLists.txt:84 (include)
    
    
    CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:86 (list):
      list GET given empty list
    Call Stack (most recent call first):
      CMakeLists.txt:84 (include)
    
    
    CMake Error at cmake/OpenCVDetectCXXCompiler.cmake:89 (math):
      math cannot parse the expression: "*100 + ": syntax error, unexpected
      exp_TIMES (1).
    Call Stack (most recent call first):
      CMakeLists.txt:84 (include)
    
    
    -- Detected version of GNU GCC:  (ERROR)
    -- Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf.so
    -- checking for module 'gstreamer-video-1.0'
    --   package 'gstreamer-video-1.0' not found
    -- checking for module 'gstreamer-app-1.0'
    --   package 'gstreamer-app-1.0' not found
    -- checking for module 'gstreamer-riff-1.0'
    --   package 'gstreamer-riff-1.0' not found
    -- checking for module 'gstreamer-pbutils-1.0'
    --   package 'gstreamer-pbutils-1.0' not found
    -- checking for module 'gstreamer-base-0.10'
    --   package 'gstreamer-base-0.10' not found
    -- checking for module 'gstreamer-video-0.10'
    --   package 'gstreamer-video-0.10' not found
    -- checking for module 'gstreamer-app-0.10'
    --   package 'gstreamer-app-0.10' not found
    -- checking for module 'gstreamer-riff-0.10'
    --   package 'gstreamer-riff-0.10' not found
    -- checking for module 'gstreamer-pbutils-0.10'
    --   package 'gstreamer-pbutils-0.10' not found
    -- Looking for linux/videodev.h
    -- Looking for linux/videodev.h - not found
    -- Looking for linux/videodev2.h
    -- Looking for linux/videodev2.h - found
    -- Looking for sys/videoio.h
    -- Looking for sys/videoio.h - not found
    -- Looking for libavformat/avformat.h
    -- Looking for libavformat/avformat.h - found
    -- Looking for ffmpeg/avformat.h
    -- Looking for ffmpeg/avformat.h - not found
    -- 
    -- General configuration for OpenCV 2.4.11 =====================================
    --   Version control:               unknown
    -- 
    --   Platform:
    --     Host:                        Linux 5.8.0-41-generic x86_64
    --     CMake:                       3.16.3
    --     CMake generator:             Unix Makefiles
    --     CMake build tool:            /usr/bin/make
    --     Configuration:               Release
    -- 
    --   C/C++:
    --     Built as dynamic libs?:      YES
    --     C++ Compiler:                /usr/bin/c++  (ver 9.3.0)
    --     C++ flags (Release):         -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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
    --     C++ flags (Debug):           -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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
    --     C Compiler:                  /usr/bin/cc
    --     C flags (Release):           -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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -O3 -DNDEBUG  -DNDEBUG
    --     C flags (Debug):             -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 -Wno-long-long -pthread -fomit-frame-pointer -msse -msse2 -msse3 -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG
    --     Linker flags (Release):
    --     Linker flags (Debug):
    --     Precompiled headers:         YES
    -- 
    --   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:                          NO
    --     GTK+ 2.x:                    YES (ver 2.24.32)
    --     GThread :                    YES (ver 2.64.6)
    --     GtkGlExt:                    NO
    --     OpenGL support:              NO
    --     VTK support:                 NO
    -- 
    --   Media I/O: 
    --     ZLib:                        /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
    --     JPEG:                        /usr/lib/x86_64-linux-gnu/libjpeg.so (ver )
    --     PNG:                         /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
    --     TIFF:                        /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 - 4.1.0)
    --     JPEG 2000:                   /usr/lib/x86_64-linux-gnu/libjasper.so (ver 1.900.1)
    --     OpenEXR:                     /usr/lib/x86_64-linux-gnu/libImath.so /usr/lib/x86_64-linux-gnu/libIlmImf.so /usr/lib/x86_64-linux-gnu/libIex.so /usr/lib/x86_64-linux-gnu/libHalf.so /usr/lib/x86_64-linux-gnu/libIlmThread.so (ver 2.3.0)
    -- 
    --   Video I/O:
    --     DC1394 1.x:                  NO
    --     DC1394 2.x:                  YES (ver 2.2.5)
    --     FFMPEG:                      YES
    --       codec:                     YES (ver 58.54.100)
    --       format:                    YES (ver 58.29.100)
    --       util:                      YES (ver 56.31.100)
    --       swscale:                   YES (ver 5.5.100)
    --       gentoo-style:              YES
    --     GStreamer:                   NO
    --     OpenNI:                      NO
    --     OpenNI PrimeSensor Modules:  NO
    --     PvAPI:                       NO
    --     GigEVisionSDK:               NO
    --     UniCap:                      NO
    --     UniCap ucil:                 NO
    --     V4L/V4L2:                    Using libv4l1 (ver 1.18.0) / libv4l2 (ver 1.18.0)
    --     XIMEA:                       NO
    --     Xine:                        NO
    -- 
    --   Other third-party libraries:
    --     Use IPP:                     NO
    --     Use Eigen:                   YES (ver 3.3.7)
    --     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:                /home/dragonros/Downloads/SLAM_DEPS/opencv-2.4.11/3rdparty/include/opencl/1.2
    --     Use AMD FFT:                 NO
    --     Use AMD BLAS:                NO
    -- 
    --   Python:
    --     Interpreter:                 /usr/bin/python2 (ver )
    -- 
    --   Java:
    --     ant:                         NO
    --     JNI:                         /usr/lib/jvm/java-8-openjdk-amd64/include /usr/lib/jvm/java-8-openjdk-amd64/include/linux /usr/lib/jvm/java-8-openjdk-amd64/include
    --     Java tests:                  NO
    -- 
    --   Documentation:
    --     Build Documentation:         NO
    --     Sphinx:                      NO
    --     PdfLaTeX compiler:           NO
    --     Doxygen:                     NO
    -- 
    --   Tests and samples:
    --     Tests:                       YES
    --     Performance tests:           YES
    --     C/C++ Examples:              NO
    -- 
    --   Install path:                  /usr/local
    -- 
    --   cvconfig.h is in:              /home/dragonros/Downloads/SLAM_DEPS/build
    -- -----------------------------------------------------------------
    -- 
    -- Configuring incomplete, errors occurred!
    See also "/home/dragonros/Downloads/SLAM_DEPS/build/CMakeFiles/CMakeOutput.log".
    See also "/home/dragonros/Downloads/SLAM_DEPS/build/CMakeFiles/CMakeError.log".

我编译错了吗?如果没有,我该如何解决这个错误?

【问题讨论】:

    标签: c++ linux opencv cmake ros


    【解决方案1】:

    您需要将opencv2.4.13/cmake/OpenCVDetectCXXCompiler.cmake(不确定是哪一行)dumpversion 更改为dumpfullversion

    解释是that

    在更高版本的 gcc 中,dumpversion 函数无法真正完整 编译器的版本号,以便 cmake 进度失败

    推荐:在 github 上,有很多针对 4.2.0 和其他版本的重构版本。我建议为 orb_slam_ros 升级到更新的 OpenCV 版本。 Cmake列表和源文件应该分别改变。

    【讨论】:

    猜你喜欢
    • 2021-05-17
    • 1970-01-01
    • 2014-06-01
    • 2014-06-03
    • 2018-02-20
    • 1970-01-01
    • 2015-11-09
    • 2015-12-27
    • 1970-01-01
    相关资源
    最近更新 更多