ros / meta-ros

OpenEmbedded Layers for ROS 1 and ROS 2
MIT License
390 stars 254 forks source link

tf-conversions: Project 'kdl_conversions' specifies an include dir which is not found. #178

Closed KristofRobot closed 11 years ago

KristofRobot commented 11 years ago

All,

I am trying to build tf-conversions (dependency of robot-state-publisher). tf-conversions depends on kdl-conversions which depends on orocos-kdl.

orocos-kdl compiles fine using the following recipe:

$ cat orocos-kdl_1.1.102-2.bb
DESCRIPTION = "Kinematics and Dynamics Library: Orocos project to supply RealTime usable kinematics and dynamics code, it contains code for rigid body kinematics calculations and representations for kinematic structures and their inverse and forward kinematic solvers."
SECTION = "devel"
LICENSE = "LGPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=a8ffd58e6eb29a955738b8fcc9e9e8f2"

SRC_URI = "git://github.com/orocos/orocos_kinematics_dynamics.git"
SRCREV_default_pn-orocos-kdl="15fb082c10b58078841c14c067ac55f592733447"

S = "${WORKDIR}/git/orocos_kdl"

inherit cmake

FILES_${PN}-dev += "/usr/share/orocos_kdl/package.xml /usr/share/orocos_kdl/orocos_kdl-config.cmake"

Furthermore, kdl-conversion bitbakes fine as well, recipe:

$ cat kdl-conversions_1.10.6.bb 
DESCRIPTION = "Conversion functions between KDL and geometry_msgs types."
SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=12;endline=12;md5=d566ef916e9dedc494f5f793a6690ba5"

DEPENDS = "geometry-msgs orocos-kdl"

require geometry.inc

However, when trying to bitbake the following tf-conversions recipe:

$ cat tf-conversions_1.10.6.bb 
DESCRIPTION = "This package contains a set of conversion functions to convert common tf datatypes (point, vector, pose, etc) into semantically identical datatypes used by other libraries."
SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=19;endline=19;md5=d566ef916e9dedc494f5f793a6690ba5"

DEPENDS = "libeigen geometry-msgs kdl-conversions tf"

require geometry.inc

I get following error:

Log data follows:
| DEBUG: Executing python function sysroot_cleansstate
[...]
| -- Eigen found (include: /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/eigen3)
| -- Using CATKIN_DEVEL_PREFIX: /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/tf-conversions/1.10.6-r0/geometry-1.10.6/tf_conversions/build/devel
| -- Using CMAKE_PREFIX_PATH: /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr;/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/x86_64-linux/usr
| -- This workspace overlays: /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr;/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/x86_64-linux/usr
| -- Using default Python package layout
| -- Using CATKIN_ENABLE_TESTING: 0
| -- catkin 0.5.77
| CMake Error at /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/share/kdl_conversions/cmake/kdl_conversionsConfig.cmake:98 (message):
|   Project 'kdl_conversions' specifies
|   '/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/eigen3'
|   as an include dir, which is not found.  It does neither exist as an
|   absolute directory nor in
|   '/usr//home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/eigen3'.
|   Ask the maintainer 'Tully Foote <tfoote@willowgarage.com>' to fix it.
| Call Stack (most recent call first):
|   /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/x86_64-linux/usr/share/catkin/cmake/catkinConfig.cmake:72 (find_package)
|   CMakeLists.txt:5 (find_package)

Somehow the valid "/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/eigen3" path is prepended with an unnecessary "/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless".

Any pointers would be much appreciated.

Thanks,

Kristof

KristofRobot commented 11 years ago

Another approach I took was to use the new "catkinized" version of orocos-kdl from https://github.com/orocos/orocos_kinematics_dynamics/pull/1, recipe:

$ cat orocos-kdl_1.1.102-3.bb
DESCRIPTION = "Kinematics and Dynamics Library: Orocos project to supply RealTime usable kinematics and dynamics code, it contains code for rigid body kinematics calculations and representations for kinematic structures and their inverse and forward kinematic solvers."
SECTION = "devel"
LICENSE = "LGPL"
LIC_FILES_CHKSUM = "file://COPYING;md5=a8ffd58e6eb29a955738b8fcc9e9e8f2"

SRC_URI = "git://github.com/jhu-lcsr-forks/orocos_kinematics_dynamics.git;tag=catkin"
SRCREV_default_pn-orocos-kdl="45dbbaeb53ab15e036ab8cc45af51f94ee9b4494"

S = "${WORKDIR}/git/kdl"

inherit catkin

FILES_${PN}-dev += "/usr/share/kdl/package.xml /usr/share/orocos-kdl/orocos-kdl-config.cmake usr/lib/liborocos-kdl.so"

This builds fine.

kdl-conversions bitbakes as well, after applying a patch to CMakeLists.txt to make use of Orocos-KDL as explained at https://github.com/jhu-lcsr-forks/orocos_kinematics_dynamics:

$ cat kdl-conversions/0001-link-against-catkinized-orocos-kdl.patch 
diff --git a/kdl_conversions/CMakeLists.txt b/kdl_conversions/CMakeLists.txt
index 2f833bd..6c1b353 100644
--- a/kdl_conversions/CMakeLists.txt
+++ b/kdl_conversions/CMakeLists.txt
@@ -2,23 +2,22 @@ cmake_minimum_required(VERSION 2.8)
 project(kdl_conversions)

 find_package(catkin REQUIRED geometry_msgs)
-find_package(orocos_kdl REQUIRED)
+find_package(Orocos-KDL REQUIRED)
 catkin_package(
   INCLUDE_DIRS include
   LIBRARIES ${PROJECT_NAME}
   CATKIN_DEPENDS geometry_msgs 
-  DEPENDS orocos_kdl
 )

-include_directories(include ${catkin_INCLUDE_DIRS} ${orocos_kdl_INCLUDE_DIRS})
+include_directories(include ${catkin_INCLUDE_DIRS} ${Orocos-KDL_INCLUDE_DIRS})
 link_directories(${catkin_LIBRARY_DIRS})
-link_directories(${orocos_kdl_LIBRARY_DIRS})
+link_directories(${Orocos-KDL_LIBRARY_DIRS})

 add_library(${PROJECT_NAME}
   src/kdl_msg.cpp
 )
 add_dependencies(${PROJECT_NAME} geometry_msgs_gencpp)
-target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${orocos_kdl_LIBRARIES})
+target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${Orocos-KDL_LIBRARIES})

 install(DIRECTORY include/${PROJECT_NAME}/
   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})

tf-conversions then bitbakes correctly without any patch.

kdl-parser first fails with a similar error as kdl-conversions before applying the patch:

|   Could not find a package configuration file provided by "orocos_kdl" with
|   any of the following names:
| 
|     orocos_kdlConfig.cmake
|     orocos_kdl-config.cmake

After applying similar patch as for tf-conversions, it still fails with:

| /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/x86_64-linux/usr/bin/armv7a-vfp-neon-oe-linux-gnueabi/arm-oe-linux-gnueabi-g++   -DROS_PACKAGE_NAME=\"kdl_parser\" -Dkdl_parser_EXPORTS -march=armv7-a -mthumb-interwork -mfloat-abi=softfp -mfpu=neon  --sysroot=/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless  -O2 -pipe -g -feliminate-unused-debug-types -fpermissive -fvisibility-inlines-hidden -fpermissive -fPIC -I/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include -I/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/kdl-parser/1.10.15-r0/robot_model-1.10.15/kdl_parser/include -I/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/eigen3    -o CMakeFiles/kdl_parser.dir/src/kdl_parser.cpp.o -c /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/kdl-parser/1.10.15-r0/robot_model-1.10.15/kdl_parser/src/kdl_parser.cpp
| In file included from /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/kdl/jntarray.hpp:26:0,
|                  from /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/kdl/frames_io.hpp:81,
|                  from /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/work/armv7a-vfp-neon-oe-linux-gnueabi/kdl-parser/1.10.15-r0/robot_model-1.10.15/kdl_parser/src/kdl_parser.cpp:39:
| /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/kdl/jacobian.hpp:26:22: fatal error: Eigen/Core: No such file or directory
|  #include <Eigen/Core>

Interestingly, the same issue as with the earlier approach seems to occur here: "/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/eigen3" is prepended with "/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless"

Again, any pointers would be very welcome.

Thanks!

Kristof

PS: This version is currently on my freenect-stack, in case you would like to try it out - https://github.com/KristofRobot/meta-ros/tree/freenect-stack

herbrechtsmeier commented 11 years ago

The error comes from the PackageConfig.cmake from the kdl_conversions pack: /home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/share/kdl_conversions/cmake/kdl_conversionsConfig.cmake

I expect that you need to fix this package or catkin to only save the local path without DESTDIR in the PackageConfig.cmake.

KristofRobot commented 11 years ago

Thanks.

Based on your suggestions, I looked a bit deeper into the PackageConfig generation part.

AFAIK the *Config.cmake generation of kdl-conversions is taken care of by catkin, so I suspect the problem lies in the input given to catkin, i.e. in CmakeLists.txt. Specifically, I think the problem is with the inclusion of ${orocos_kdl_INCLUDE_DIRS}.

Also, I now realize that in my second approach, I was not really patching the respective CmakeLists.txt files in a "catkinized" way ([1]), but rather in a "cmake" way. Will try again with find_package(catkin REQUIRED COMPONENTS Orocos-KDL) and without explicitly setting Orocos-KDL_* variables (should be taken care of by catkin).

If that doesn't work,I think I have to dig into the PackageConfig generation code of Orocos-KDL.

Any further comments/pointers always welcome.

Thanks!

[1] http://wiki.ros.org/catkin/CMakeLists.txt

KristofRobot commented 11 years ago

Looking a bit deeper into the pkgconfig process of orocos-kdl, I find that it indeed records a wrong path in orocos_kdl.pc:

[...]/sysroot-destdir/usr/lib/pkgconfig$ cat orocos_kdl.pc 
prefix=/usr
libdir=${prefix}/lib
includedir=${prefix}/include

Name: orocos-kdl
Description: The Orocos Kinematics and Dynamics Library 
Requires: 
Version: 1.1.99
Libs: -L${libdir} -lorocos-kdl
Cflags: -I${includedir}  -I/home/kristof/cubie/OE/oe-core/build/tmp-eglibc/sysroots/cubieboard2_headless/usr/include/eigen3

I believe the Cflags part should read instead:

Cflags: -I${includedir}  -I/usr/include/eigen3

This is then later picked up by kdl-conversions, etc.

Still need to figure out which code generates this orocos_kdl.pc file.

KristofRobot commented 11 years ago

OK, this is set in https://github.com/orocos/orocos_kinematics_dynamics/blob/master/orocos_kdl/src/kdl.pc.in

prefix=@CMAKE_INSTALL_PREFIX@
libdir=${prefix}/lib
includedir=${prefix}/include

Name: orocos-kdl
Description: The Orocos Kinematics and Dynamics Library
Requires:
Version: @KDL_VERSION@
Libs: -L${libdir} -lorocos-kdl
Cflags: -I${includedir} @KDL_CFLAGS@

KDL_CFLAGS is set in CMakeLists.txt: SET(KDL_CFLAGS "${KDL_CFLAGS} -I${Eigen_INCLUDE_DIR}"

Since the only KDL_CFLAGS being set is this Eigen Include path, I guess I can simply replace the @KDL_CFLAGS@ in kdl.pc.in by -I${Eigen_INCLUDE_DIR}

However, that looks like an ugly hack. Is there a more elegant way of patching this?

herbrechtsmeier commented 11 years ago

We have to replace all full paths in the pkgConfig.pc and pkgConfig.cmake file with the equivalent variables. Something similar to the binconfig.bbclass, the nss.inc or qt4.inc.

KristofRobot commented 11 years ago

Thanks, great pointers!

Ended up fixing this as follows:

do_install_append() {
        # remove sysroot library path from pkgconfig files
        sed -i -e 's#${STAGING_INCDIR}#${includedir}#g' \
                   ${D}${libdir}/pkgconfig/*.pc
}

Now I am able to compile robot-state-publisher :)

bulwahn commented 11 years ago

Great that you were successful. Please provide those patches to the main repository for reviewing and merging.

KristofRobot commented 11 years ago

I'd be happy to, but one of my core dependencies is PCL, on which there is still an open issue (https://github.com/bmwcarit/meta-ros/issues/135) - trying to close on that one first...

KristofRobot commented 11 years ago

This is actually not correct, robot-state-publisher does not depend on PCL, I should be able to prepare a pull request for that one already. It is freenect-stack that depends on PCL.