在编译cartographer的时候出现了如下问题:
CMake Error at /usr/local/lib/cmake/Ceres/CeresConfig.cmake:93 (message):
Failed to find Ceres - Found Eigen dependency, but the version of Eigen
found (3.2.9) does not exactly match the version of Eigen Ceres was
compiled with happy(). This can cause subtle bugs by triggering violations
of the One Definition Rule. See the Wikipedia article
http://en.wikipedia.org/wiki/One_Definition_Rule for more details
Call Stack (most recent call first):
/usr/local/lib/cmake/Ceres/CeresConfig.cmake:223 (ceres_report_not_found)
CMakeLists.txt:43 (find_package)
-- Configuring incomplete, errors occurred!
搜索问题后发现解决办法
解决方法
按照方法在文件头部添加如下代码后无效。
set(CERES_EIGEN_VERSION 3.2.9)
set(EIGEN_INCLUDE_DIRS "/usr/local/include/eigen3")
分析代码发现,在提到的编译错误中 (3.2.9)和()空括号里应该分别是编译文件搜索到的Eigen版本号和CERES_EIGEN_VERSION 设置的版本号,但在编译中发现CERES_EIGEN_VERSION 并没有打印出来设置的内容,因此推断set没有产生效果,反复测试后发现,上述set语句应放在参数使用区域附近,至于具体原因,在下没咋看过cmake原理…不太知道,希望了解的大哥可以告知!!!
set(CERES_EIGEN_VERSION 3.2.9)
set(EIGEN_INCLUDE_DIRS "/usr/local/include/eigen3")
if (EIGEN_FOUND)
if (NOT EIGEN_VERSION VERSION_EQUAL CERES_EIGEN_VERSION)
# CMake's VERSION check in FIND_PACKAGE() will accept any version >= the
# specified version. However, only version = is supported. Improve
# usability by explaining why we don't accept non-exact version matching.
ceres_report_not_found("Found Eigen dependency, but the version of Eigen "
"found (${EIGEN_VERSION}) does not exactly match the version of Eigen "
"Ceres was compiled with (${CERES_EIGEN_VERSION}). This can cause subtle "
"bugs by triggering violations of the One Definition Rule. See the "
"Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule "
"for more details"
)
endif ()
错误记录