Hi everybody,
i'm trying to use eigen with ros electric. I don't know if I'm missing some aspects or just misunderstand the whole thing. I installed eigen via
sudo apt-get install ros-electric-eigen
As mentioned in the eigen Wiki for electric Installation I downloaded the FindEigen.cmake and moved it in the cmake directory of my package.
In the CMakeList.txt I appended
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(Eigen REQUIRED)
include_directories(${EIGEN_INCLUDE_DIRS})
Furthermore I edited the manifest.xml and included
<depend package="common_rosdeps" />
<rosdep name="eigen" />
But now I don't know how to include it within my cpp file. I've had look at the laser_geometry package, where the FindEigen.cmake comes from, but if I do it like this
#include <ros/ros.h>
#include <Eigen/Core>
...
i get an error making my package:
fatal error Eigen/Core: No such file or directory
What do i have to include within my cpp file or am I doing something else quite wrong? Most information I've found does not cover my problem or is referring to Fuerte installs.
thanking you in anticipation
Ah, ok sorry. Just referred to the errors. Here the rosmake output:
[ rosmake ] No package specified. Building ['testEigen']
[ rosmake ] Packages requested are: ['testEigen']
[ rosmake ] Logging to directory/home/namco/.ros/rosmake/rosmake_output-20121107-163504
[ rosmake ] Expanded args ['testEigen'] to:
['testEigen']
[ rosmake ] Checking rosdeps compliance for packages testEigen. This may take a few seconds.
[ rosmake ] rosdep check passed all system dependencies in packages
[rosmake-0] Starting >>> rosbuild [ make ]
[rosmake-0] Finished <<< rosbuild ROS_NOBUILD in package rosbuild
No Makefile in package rosbuild
[rosmake-1] Starting >>> cpp_common [ make ]
[rosmake-0] Starting >>> roslang [ make ]
[rosmake-0] Finished <<< roslang ROS_NOBUILD in package roslang
No Makefile in package roslang
[rosmake-1] Finished <<< cpp_common ROS_NOBUILD in package cpp_common
[rosmake-0] Starting >>> roslib [ make ]
[rosmake-1] Starting >>> roscpp_traits [ make ]
[rosmake-0] Finished <<< roslib ROS_NOBUILD in package roslib
[rosmake-1] Finished <<< roscpp_traits ROS_NOBUILD in package roscpp_traits
[rosmake-0] Starting >>> rostime [ make ]
[rosmake-0] Finished <<< rostime ROS_NOBUILD in package rostime
[rosmake-1] Starting >>> xmlrpcpp [ make ]
[rosmake-0] Starting >>> roscpp_serialization [ make ]
[rosmake-0] Finished <<< roscpp_serialization ROS_NOBUILD in package roscpp_serialization
[rosmake-1] Finished <<< xmlrpcpp ROS_NOBUILD in package xmlrpcpp
[rosmake-0] Starting >>> rosconsole [ make ]
[rosmake-0] Finished <<< rosconsole ROS_NOBUILD in package rosconsole
[rosmake-1] Starting >>> std_msgs [ make ]
[rosmake-1] Finished <<< std_msgs ROS_NOBUILD in package std_msgs
[rosmake-0] Starting >>> common_rosdeps [ make ]
[rosmake-1] Starting >>> rosgraph_msgs [ make ]
[rosmake-0] Finished <<< common_rosdeps ROS_NOBUILD in package common_rosdeps
[rosmake-1] Finished <<< rosgraph_msgs ROS_NOBUILD in package rosgraph_msgs
[rosmake-1] Starting >>> roscpp [ make ]
[rosmake-1] Finished <<< roscpp ROS_NOBUILD in package roscpp
[rosmake-1] Starting >>> testEigen [ make ]
[ rosmake ] All 37 linesestEigen: 4.0 sec ] [ 1 Active 14/15 Complete ]
{-------------------------------------------------------------------------------
mkdir -p bin
cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake ..
[rosbuild] Building package testEigen
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/roslisp/cmake/roslisp.cmake
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/rospy/cmake/rospy.cmake
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_TOOLCHAIN_FILE
-- Build files have been written to: /home/namco/ros/testEigen/build
cd build && make -l2
make[1]: Entering directory `/home/namco/ros/testEigen/build'
make[2]: Entering directory `/home/namco/ros/testEigen/build'
make[3]: Entering directory `/home/namco/ros/testEigen/build'
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
[ 0%] Built target rospack_genmsg_libexe
make[3]: Entering directory `/home/namco/ros/testEigen/build'
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
[ 0%] Built target rosbuild_precompile
make[3]: Entering directory `/home/namco/ros/testEigen/build'
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
make[3]: Entering directory `/home/namco/ros/testEigen/build'
[100%] Building CXX object CMakeFiles/testEigen.dir/src/testEigen.o
/home/namco/ros/testEigen/src/testEigen.cpp:2:22: fatal error: Eigen/Core: No such file or directory
compilation terminated.
make[3]: *** [CMakeFiles/testEigen.dir/src/testEigen.o] Error 1
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
make[2]: *** [CMakeFiles/testEigen.dir/all] Error 2
make[2]: Leaving directory `/home/namco/ros/testEigen/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/namco/ros/testEigen/build'
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package testEigen written to:
[ rosmake ] /home/namco/.ros/rosmake/rosmake_output-20121107-163504/testEigen/build_output.log
[rosmake-1] Finished <<< testEigen [FAIL] [ 4.07 seconds ]
[ rosmake ] Halting due to failure in package testEigen.
[ rosmake ] Waiting for other threads to complete.
[ rosmake ] Results:
[ rosmake ] Built 15 packages with 1 failures.
[ rosmake ] Summary output to directory
[ rosmake ] /home/namco/.ros/rosmake/rosmake_output-20121107-163504
And here the make VERBOSE=1 output
mkdir -p bin
cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=`rospack find rosbuild`/rostoolchain.cmake ..
Re-run cmake no build system arguments
[rosbuild] Building package testEigen
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/roslisp/cmake/roslisp.cmake
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/rospy/cmake/rospy.cmake
[rosbuild] Including /opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
CMAKE_TOOLCHAIN_FILE
-- Build files have been written to: /home/namco/ros/testEigen/build
cd build && make
make[1]: Entering directory `/home/namco/ros/testEigen/build'
/usr/bin/cmake -H/home/namco/ros/testEigen -B/home/namco/ros/testEigen/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/namco/ros/testEigen/build/CMakeFiles /home/namco/ros/testEigen/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[2]: Entering directory `/home/namco/ros/testEigen/build'
make -f CMakeFiles/rospack_genmsg_libexe.dir/build.make CMakeFiles/rospack_genmsg_libexe.dir/depend
make[3]: Entering directory `/home/namco/ros/testEigen/build'
cd /home/namco/ros/testEigen/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/namco/ros/testEigen /home/namco/ros/testEigen /home/namco/ros/testEigen/build /home/namco/ros/testEigen/build /home/namco/ros/testEigen/build/CMakeFiles/rospack_genmsg_libexe.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
make -f CMakeFiles/rospack_genmsg_libexe.dir/build.make CMakeFiles/rospack_genmsg_libexe.dir/build
make[3]: Entering directory `/home/namco/ros/testEigen/build'
make[3]: Nothing to be done for `CMakeFiles/rospack_genmsg_libexe.dir/build'.
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
/usr/bin/cmake -E cmake_progress_report /home/namco/ros/testEigen/build/CMakeFiles
[ 0%] Built target rospack_genmsg_libexe
make -f CMakeFiles/rosbuild_precompile.dir/build.make CMakeFiles/rosbuild_precompile.dir/depend
make[3]: Entering directory `/home/namco/ros/testEigen/build'
cd /home/namco/ros/testEigen/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/namco/ros/testEigen /home/namco/ros/testEigen /home/namco/ros/testEigen/build /home/namco/ros/testEigen/build /home/namco/ros/testEigen/build/CMakeFiles/rosbuild_precompile.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
make -f CMakeFiles/rosbuild_precompile.dir/build.make CMakeFiles/rosbuild_precompile.dir/build
make[3]: Entering directory `/home/namco/ros/testEigen/build'
make[3]: Nothing to be done for `CMakeFiles/rosbuild_precompile.dir/build'.
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
/usr/bin/cmake -E cmake_progress_report /home/namco/ros/testEigen/build/CMakeFiles
[ 0%] Built target rosbuild_precompile
make -f CMakeFiles/testEigen.dir/build.make CMakeFiles/testEigen.dir/depend
make[3]: Entering directory `/home/namco/ros/testEigen/build'
cd /home/namco/ros/testEigen/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/namco/ros/testEigen /home/namco/ros/testEigen /home/namco/ros/testEigen/build /home/namco/ros/testEigen/build /home/namco/ros/testEigen/build/CMakeFiles/testEigen.dir/DependInfo.cmake --color=
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
make -f CMakeFiles/testEigen.dir/build.make CMakeFiles/testEigen.dir/build
make[3]: Entering directory `/home/namco/ros/testEigen/build'
/usr/bin/cmake -E cmake_progress_report /home/namco/ros/testEigen/build/CMakeFiles 1
[100%] Building CXX object CMakeFiles/testEigen.dir/src/testEigen.o
/usr/bin/c++ -O2 -g -I/home/namco/ros/testEigen/include -I/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/include -I/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/msg_gen/cpp/include -I/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp/srv_gen/cpp/include -I/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_serialization/include -I/opt/ros/electric/stacks/ros_comm/clients/cpp/roscpp_traits/include -I/opt/ros/electric/stacks/ros_comm/utilities/xmlrpcpp/src -I/opt/ros/electric/stacks/ros_comm/tools/rosconsole/include -I/opt/ros/electric/stacks/ros_comm/utilities/rostime/include -I/opt/ros/electric/stacks/ros_comm/utilities/cpp_common/include -I/opt/ros/electric/stacks/ros_comm/messages/rosgraph_msgs/msg_gen/cpp/include -I/opt/ros/electric/stacks/ros_comm/messages/std_msgs/include -I/opt/ros/electric/stacks/ros_comm/messages/std_msgs/msg_gen/cpp/include -I/opt/ros/electric/ros/core/roslib/msg_gen/cpp/include -I/opt/ros/electric/ros/core/roslib/include -I/opt/ros/electric/ros/tools/rospack -I/opt/ros/electric/ros/tools/rospack/include -DROS_PACKAGE_NAME='"testEigen"' -W -Wall -Wno-unused-parameter -fno-strict-aliasing -pthread -o CMakeFiles/testEigen.dir/src/testEigen.o -c /home/namco/ros/testEigen/src/testEigen.cpp
/home/namco/ros/testEigen/src/testEigen.cpp:2:22: fatal error: Eigen/Core: No such file or directory
compilation terminated.
make[3]: *** [CMakeFiles/testEigen.dir/src/testEigen.o] Error 1
make[3]: Leaving directory `/home/namco/ros/testEigen/build'
make[2]: *** [CMakeFiles/testEigen.dir/all] Error 2
make[2]: Leaving directory `/home/namco/ros/testEigen/build'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/namco/ros/testEigen/build'
make: *** [all] Error 2
EDIT: Sorry for answering own post, fixed it (but you comments also disappeared). Not familiar with ROS answers yet.
Originally posted by boFFeL on ROS Answers with karma: 31 on 2012-11-07
Post score: 1
Original comments
Comment by dornhege on 2012-11-07:
Did you get any other errors? What is the output of VERBOSE=1 make
?
Comment by boFFeL on 2012-11-07:
No, when i do make VERBOSE=1 it's the same. Only this error and after that compilation is terminated.
Comment by dornhege on 2012-11-07:
I'm sure, there is more output than just the error. Please provide the COMPLETE output.
Comment by dornhege on 2012-11-07:
eigen is not added to the include. If it is installed, check the output of the variables that FindEigen produces.
Comment by dornhege on 2012-11-07:
Your fix is not a real fix. You basically manually specified to look in /usr/include/eigen3/Eigen/Core. The original code was correct. The problem lies in the compile setup, which should add /usr/include/eigen3 to the include.
Comment by boFFeL on 2012-11-07:
Okay, I see what you mean. FindEigen should produce EIGEN_FOUND, EIGEN_INCLUDE_DIR and EIGEN_VERSION, correct? So they should be via echo $EIGEN_FOUND available after rosmake? Or after running CMakeList.txt? I use QtCreator in which i can run them. Nevertheless there are no Variables available.
Comment by dornhege on 2012-11-07:
Yes, those should be produced. Either they are not produced or not used for some reason.Those are not environment variables, but CMAKE variables. You can use cmake's message function to output them.
Comment by boFFeL on 2012-11-07:
If I message Variables at the end of CMakeList.txt I get TRUE for EIGEN_FOUND, /usr/include/eigen3 for EIGEN_INCLUDE_DIR and 3.0.1 for EIGEN_VERSION
Comment by dornhege on 2012-11-07:
Is EIGEN_INCLUDE_DIRS also set? You are using include_directories(EIGEN_INCLUDE_DIRS). This is listed in the tutorial and I have that running successfully, too.
Comment by boFFeL on 2012-11-08:
It's also set to /usr/include/eigen3. Hmm :-(