简体   繁体   English

使用 Ceres 求解器进行 CMake 项目时的 Eigen 依赖项冲突

[英]Conflicting Eigen dependencies when CMake-ing project with Ceres solver

I installed ceres-solver using我安装了ceres-solver使用

brew install ceres-solver

on macOS.在 macOS 上。

I created a CMake.txt for a client project that uses Ceres.我为使用 Ceres 的客户端项目创建了CMake.txt

cmake_minimum_required(VERSION 2.8)

project(helloworld)

find_package(Ceres REQUIRED)
include_directories(${CERES_INCLUDE_DIRS})

# helloworld
add_executable(helloworld helloworld.cpp)
target_link_libraries(helloworld ${CERES_LIBRARIES})

However, when I run the following command但是,当我运行以下命令时

cmake. -Bbuild

I get the following error我收到以下错误

CMake Error at /usr/local/lib/cmake/Ceres/CeresConfig.cmake:88 (message):
  Failed to find Ceres - Found Eigen dependency, but the version of Eigen
  found (3.3.90) does not exactly match the version of Eigen Ceres was
  compiled with (3.3.7).  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:5 (find_package)


CMake Error at CMakeLists.txt:5 (find_package):
  Found package configuration file:

    /usr/local/lib/cmake/Ceres/CeresConfig.cmake

  but it set Ceres_FOUND to FALSE so package "Ceres" is considered to be NOT
  FOUND.


-- Configuring incomplete, errors occurred!

How do I remove the conflicting version of Eigen?如何删除 Eigen 的冲突版本? I don't remember how I installed it in the past.我不记得我过去是如何安装它的。 I tried running brew uninstall Eigen as well, but that didn't make the error go away.我也尝试运行brew uninstall Eigen ,但这并没有使错误 go 消失。

Thanks for any help.谢谢你的帮助。

So Ceres was built with Eigen 3.3.7 but your helloworld build is finding Eigen 3.3.90.因此,Ceres 是使用 Eigen 3.3.7 构建的,但您的 helloworld 构建正在寻找 Eigen 3.3.90。 The best way I have found to track down cmake problems like this is to use the --trace-expand and --debug-output options when running the cmake configure step.我发现跟踪此类 cmake 问题的最佳方法是在运行 cmake 配置步骤时使用--trace-expand--debug-output选项。 It generates a lot of output so redirect it all to a file and then search for the find_package eigen statement.它会生成很多 output 所以将它们全部重定向到一个文件,然后搜索 find_package eigen 语句。 For example例如

cmake . -Bbuild --debug-output --trace-expand > cmake.out 2>&1

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

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