Skip to content
Advertisement

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. I have 4.2.0 but it doesn’t work but according to ROS, it has been tested to work on 2.4.11. Here is what I did:

  • Download the source zip file.
  • Extract it.
  • Go into the directory and create a build folder.
  • Go into the build folder and run 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?

Advertisement

Answer

You need to change opencv2.4.13/cmake/OpenCVDetectCXXCompiler.cmake (not sure which line) dumpversion to dumpfullversion

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

Recommendation: On github, there plenty of refactored versions for both 4.2.0 and others. I recommend to upgrade to newer OpenCV versions for orb_slam_ros. Cmake lists and source files should be changed respectively.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement