简体   繁体   English

OpenCV 2.4.11 ROS ORB_SLAM2 编译失败

[英]OpenCV 2.4.11 Compilation For ROS ORB_SLAM2 Fails

I am trying to get orb_slam2_ros to compile and it needed an OpenCV version higher than 2.3.我正在尝试编译 orb_slam2_ros,它需要高于 2.3 的 OpenCV 版本。 I have 4.2.0 but it doesn't work but according to ROS, it has been tested to work on 2.4.11.我有 4.2.0 但它不起作用,但根据 ROS,它已经过测试可以在 2.4.11 上运行。 Here is what I did:这是我所做的:

  • Download the source zip file.下载源 zip 文件。
  • Extract it.提取它。
  • Go into the directory and create a build folder. Go 进入目录并创建一个构建文件夹。
  • Go into the build folder and run cmake.. . Go 进入构建文件夹并运行cmake.. There is gives me this:有给我这个:

    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".

Am I compiling it wrong?我编译错了吗? If not, how can I resolve this error?如果没有,我该如何解决这个错误?

You need to change opencv2.4.13/cmake/OpenCVDetectCXXCompiler.cmake (not sure which line) dumpversion to dumpfullversion您需要将opencv2.4.13/cmake/OpenCVDetectCXXCompiler.cmake (不确定哪一行) dumpversiondumpfullversion

Explanation is that解释

In gcc with higher version, dumpversion function can't get true full version number of compiler so that cmake progress will fail在更高版本的 gcc 中,dumpversion function 无法获得编译器的真实完整版本号,因此 cmake 进度将失败

Recommendation : On github, there plenty of refactored versions for both 4.2.0 and others.建议:在 github 上,4.2.0 和其他版本都有很多重构版本。 I recommend to upgrade to newer OpenCV versions for orb_slam_ros.我建议为 orb_slam_ros 升级到更新的 OpenCV 版本。 Cmake lists and source files should be changed respectively. Cmake 列表和源文件应分别更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM