照着这个instructions安装好 rgbdslamv2,并且在安装的过程中,后续要用的依赖也已经安装好了
Step2:https://www.twblogs.net/a/5c542fdcbd9eee06ee218f6c/zh-cn
照着高翔的指导一步一步的学习,存在的大部分问题在上面的博客中可以解决
备注:
关于g20部分,代码提示c++11不兼容等诸多问题,在src目录下添加支持c++11即可
include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) if(COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(COMPILER_SUPPORTS_CXX0X) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") else() message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) endif(COMMAND cmake_policy)
step3:关于g2o_viewer提示core dump段错误问题
这是因为编译时qt4 qt5不兼容问题,解决办法,(qt5 版本)
- 1 sudo apt-get install libqglviewer-dev
- 2 qmake -v 检查是不是qt5
- 3 找到g2o源码目录的cmake_module目录,打开FindQGViewer.cmake
- 4 把前几行关于qt4的部分注释掉添加
# Need to find both Qt{4,5} and QGLViewer if the QQL support is to be built #FIND_PACKAGE(Qt4 COMPONENTS QtCore QtXml QtOpenGL QtGui) #IF(NOT Qt4_FOUND) # FIND_PACKAGE(Qt5 QUIET COMPONENTS Core Xml OpenGL Gui Widgets) # IF(NOT Qt4_FOUND AND NOT Qt5_FOUND) # MESSAGE("Qt{4,5} not found. Install it and set Qt{4,5}_DIR accordingly") # IF (WIN32) # MESSAGE(" In Windows, Qt5_DIR should be something like C:/Qt/5.4/msvc2013_64_opengl/lib/cmake/Qt5") # ENDIF() # ENDIF() #ENDIF() FIND_PACKAGE(Qt5 COMPONENTS Core Xml OpenGL Gui Widgets) IF(NOT Qt5_FOUND) MESSAGE("Qt5 not found. Install it and set Qt5_DIR accordingly") IF (WIN32) MESSAGE(" In Windows, Qt5_DIR should be something like C:/Qt/5.4/msvc2013_64_opengl/lib/cmake/Qt5") ENDIF() ENDIF()
关于find_library(QGLVIEWER_LIBRARY_RELEASE 和 find_library(QGLVIEWER_LIBRARY_DEBUG的部分 改成一下内容
find_library(QGLVIEWER_LIBRARY_RELEASE #NAMES qglviewer-qt4 qglviewer QGLViewer QGLViewer2 #NAMES qglviewer-qt5 QGLViewer-qt5 #NAMES qglviewer-qt4 QGLViewer-qt4 qglviewer QGLViewer QGLViewer2 NAMES qglviewer QGLViewer PATHS /usr/lib /usr/local/lib /opt/local/lib /usr/lib/x86_64-linux-gnu /sw/lib ENV QGLVIEWERROOT ENV LD_LIBRARY_PATH ENV LIBRARY_PATH PATH_SUFFIXES QGLViewer QGLViewer/release ) find_library(QGLVIEWER_LIBRARY_DEBUG #NAMES dqglviewer dQGLViewer dQGLViewer2 QGLViewerd2 NAMES dqglviewer dQGLViewer dQGLViewer QGLViewerd2 PATHS /usr/lib /usr/local/lib /opt/local/lib /usr/lib/x86_64-linux-gnu /sw/lib ENV QGLVIEWERROOT ENV LD_LIBRARY_PATH ENV LIBRARY_PATH #PATH_SUFFIXES QGLViewer QGLViewer/release PATH_SUFFIXES QGLViewer QGLViewer/debug )
- 5 返回g2o/build ,执行
cmake .. make -j4 make install
- 6 运行g2o_viewer 便成功了
工作环境:ubuntu16.04