<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[在ROS使用自己安装的eigen时的cmake错误]]></title><description><![CDATA[<p dir="auto">在我在自己的ROS系统中安装最新的eigen后，在自己的工作空间执行<code>catkin_make</code>后出现了如下的错误</p>
<pre><code>CMake Error at /opt/ros/kinetic/share/eigen_conversions/cmake/eigen_conversionsConfig.cmake:106 (message):
  Project 'eigen_conversions' specifies '/usr/include/eigen3' as an include
  dir, which is not found.  It does neither exist as an absolute directory
  nor in '/opt/ros/kinetic//usr/include/eigen3'.  Ask the maintainer 'Tully
  Foote &lt;tfoote@osrfoundation.org&gt;' to fix it.
Call Stack (most recent call first):
  /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
  image_pipeline/depth_image_proc/CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/randoms/Documents/ros/workspace/build/CMakeFiles/CMakeOutput.log".
See also "/home/randoms/Documents/ros/workspace/build/CMakeFiles/CMakeError.log".
Makefile:3692: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
</code></pre>
<p dir="auto">错误原因是CMake没有找到Eigen。我的Eigen的安装位置是<code>/usr/local/include/eigen</code>而ROS系统中Eigen的默认安装位置是<code>/usr/include/eigen</code>.很显然系统在旧的位置寻找eigen包。</p>
<p dir="auto">可能影响到CMake寻找软件包软件包的目录有以下几个</p>
<pre><code>/opt/ros/kinetic/share/cmake_modules/cmake/Modules # ros 系统环境的cmake_modules
/usr/share/cmake-3.5/Modules # 系统cmake_modules， 不同版本cmake可能有些区别
/usr/lib/cmake/eigen3 # 系统的cmake环境配置
/usr/local/lib/cmake/eigen3 # 可能的另外一个路径
/usr/local/share/eigen3/cmake # eigen的CMake配置文件
</code></pre>
<p dir="auto">排查后以上的几个位置的文件后发现没有对<code>/usr/include/eigen</code>的引用。<br />
当然如果你遇到这个问题，是有可能这几个文件配置有问题的。</p>
<p dir="auto">然后顺着catkin_make一路向下查找。终于发现了问题。<br />
在<code>/opt/ros/kinetic/share/orocos_kdl</code>这个包中<code>orocos_kdl-config.cmake</code>这个文件把eigen的路径写死成了<code>/usr/include/eigen</code><br />
把文件修改成下面这样就可以了</p>
<pre><code># - Config file for the orocos-kdl package
# It defines the following variables
#  orocos_kdl_INCLUDE_DIRS - include directories for Orocos KDL
#  orocos_kdl_LIBRARIES    - libraries to link against for Orocos KDL
#  orocos_kdl_PKGCONFIG_DIR - directory containing the .pc pkgconfig files

# Compute paths
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
find_package(Eigen3)
set(orocos_kdl_INCLUDE_DIRS "${EIGEN3_INCLUDE_DIRS};/opt/ros/kinetic/include")

if(NOT TARGET orocos-kdl)
  include("${SELF_DIR}/OrocosKDLTargets.cmake")
endif()

set(orocos_kdl_LIBRARIES orocos-kdl)

# where the .pc pkgconfig files are installed
set(orocos_kdl_PKGCONFIG_DIR "/opt/ros/kinetic/lib/pkgconfig")
</code></pre>
<p dir="auto">如果你也遇到类似的问题就要定位到具体的package然后找到对应的路径进行修改就可以了。</p>
]]></description><link>http://community.bwbot.org/topic/181/在ros使用自己安装的eigen时的cmake错误</link><generator>RSS for Node</generator><lastBuildDate>Fri, 07 Aug 2026 19:05:08 GMT</lastBuildDate><atom:link href="http://community.bwbot.org/topic/181.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 14 Apr 2017 12:38:26 GMT</pubDate><ttl>60</ttl></channel></rss>