g2o-20160424 版本编译后 g2o_viewer 启动崩溃问题

QT 版本问题

旧版本g2o/cmake_modules/FindQGLViewer.cmake中优先使用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()

但是libQGLViewer是使用指令 sudo apt-get install libqglviewer-dev安装的,它是基于QT5的,所以直接替换了FindQGLViewer.cmake

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_path(QGLVIEWER_INCLUDE_DIR qglviewer.h
    /usr/include/QGLViewer
    /opt/local/include/QGLViewer
    /usr/local/include/QGLViewer
    /sw/include/QGLViewer
    ENV QGLVIEWERROOT
  )

find_library(QGLVIEWER_LIBRARY_RELEASE
  NAMES qglviewer QGLViewer qglviewer-qt5 QGLViewer-qt5
  PATHS /usr/lib
        /usr/local/lib
        /opt/local/lib
        /sw/lib
        ENV QGLVIEWERROOT
        ENV LD_LIBRARY_PATH
        ENV LIBRARY_PATH
  PATH_SUFFIXES QGLViewer QGLViewer/release
)
find_library(QGLVIEWER_LIBRARY_DEBUG
  NAMES dqglviewer dQGLViewer dqglviewer-qt5 dQGLViewer-qt5 QGLViewerd2
  PATHS /usr/lib
        /usr/local/lib
        /opt/local/lib
        /sw/lib
        ENV QGLVIEWERROOT
        ENV LD_LIBRARY_PATH
        ENV LIBRARY_PATH
  PATH_SUFFIXES QGLViewer QGLViewer/debug
)

if(QGLVIEWER_LIBRARY_RELEASE)
  if(QGLVIEWER_LIBRARY_DEBUG)
    set(QGLVIEWER_LIBRARY optimized ${QGLVIEWER_LIBRARY_RELEASE} debug ${QGLVIEWER_LIBRARY_DEBUG})
  else()
    set(QGLVIEWER_LIBRARY ${QGLVIEWER_LIBRARY_RELEASE})
  endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(QGLVIEWER DEFAULT_MSG
  QGLVIEWER_INCLUDE_DIR QGLVIEWER_LIBRARY)

或者卸载 libqglviewer-dev,安装libqglviewer-dev-qt4也行,其实就是保持QT版本一致。

 ceres-solver中Eigen3版本和当前Eigen3版本不兼容

 

posted @ 2020-08-03 20:08  采男孩的小蘑菇  阅读(550)  评论(0编辑  收藏  举报