在ROS使用自己安装的eigen时的cmake错误
Posted dxmcu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在ROS使用自己安装的eigen时的cmake错误相关的知识,希望对你有一定的参考价值。
原链接: (http://community.bwbot.org)[http://community.bwbot.org]
在我在自己的ROS系统中安装最新的eigen后,在自己的工作空间执行catkin_make
后出现了如下的错误
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 <tfoote@osrfoundation.org>' 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
错误原因是CMake没有找到Eigen。我的Eigen的安装位置是/usr/local/include/eigen
而ROS系统中Eigen的默认安装位置是/usr/include/eigen
.很显然系统在旧的位置寻找eigen包。
可能影响到CMake寻找软件包软件包的目录有以下几个
/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配置文件
排查后以上的几个位置的文件后发现没有对/usr/include/eigen
的引用。
当然如果你遇到这个问题,是有可能这几个文件配置有问题的。
然后顺着catkin_make一路向下查找。终于发现了问题。
在/opt/ros/kinetic/share/orocos_kdl
这个包中orocos_kdl-config.cmake
这个文件把eigen的路径写死成了/usr/include/eigen
把文件修改成下面这样就可以了
# - 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")
如果你也遇到类似的问题就要定位到具体的package然后找到对应的路径进行修改就可以了。
2.暴力
sudo ln -s /usr/local/include/eigen3 /usr/include/eigen3
以上是关于在ROS使用自己安装的eigen时的cmake错误的主要内容,如果未能解决你的问题,请参考以下文章