Hi Marcus, On Wed, Jul 10, 2013 at 12:59 PM, Marcus Liebhardt < marcus.liebhardt@yujinrobot.com> wrote: > > On Wed, Jul 10, 2013 at 6:39 PM, Marcus Liebhardt < > marcus.liebhardt@yujinrobot.com> wrote: > >> Hey guys, >> It's me again. Sorry for the high traffic. >> >> I released the openni_tracker and the source build works fine. However, >> when building the deb, orocos-kdl can't be found. >> >> CMake Error at /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:72 (find_package): >> Could not find a configuration file for package orocos_kdl. >> >> Set orocos_kdl_DIR to the directory containing a CMake configuration file >> for orocos_kdl. The file will have one of the following names: >> >> orocos_kdlConfig.cmake >> orocos_kdl-config.cmake >> >> Call Stack (most recent call first): >> CMakeLists.txt:3 (find_package) >> >> >> So, I started looking for the cause of this and found this seemingly >> related issue involving the geometry stack: >> https://github.com/ros/geometry/issues/11. The respective fix treats >> orocos-kdl as a plain Cmake package instead of a catkin >> package. Unfortunately, when applying this patch to the openni_tracker, my >> local source build can't find the orocos-kdl library it tries to link to: >> >> Linking CXX executable >> /opt/sandbox_workspace/devel/lib/openni_tracker/openni_tracker >> /usr/bin/ld: cannot find -lorocos-kdl >> collect2: ld returned 1 exit status >> make[2]: *** >> [/opt/sandbox_workspace/devel/lib/openni_tracker/openni_tracker] Error 1 >> >> Again I started off to find hints for the cause of this. I took a look >> at orocos_kdl-config.cmake and even the package config file, but nothing >> seems suspicious to me. However, I must say that I don't have lots of CMake >> experience. So this is harder for me than Korean. 0o >> >> One thing I noticed though is that the CMake log output about orocos-kdl >> doesn't show any linker flags: >> >> Looking for KDL in: /opt/ros/hydro >> -- checking for one of the modules 'orocos_kdl' >> Includes in: /opt/ros/hydro/include;/usr/include/eigen3 >> Compiler flags: -I/opt/ros/hydro/include;-I/usr/include/eigen3 >> Libraries: orocos-kdl >> Libraries in: /opt/ros/hydro/lib >> Linker flags : >> Defines: >> >> I will keep looking further into this. But any hints, tips and help is >> highly appreciated! >> > > Joder! I think, I have found the missing piece - it's called > "link_directories()". I shouldn't have looked only at that pull request, > but at the newest version of the mentioned CMakeLists example. > > I'm still a bit confused though. I can't remember needing this > "link_directories" addition so far. Furthermore, the ROS wiki even > recommends not to use it, since target_link_libraries() should suffice for > catkin and plain cmake packages - which is the case here ( > http://ros.org/wiki/catkin/CMakeLists.txt#Include_Paths_and_Library_Paths > ). > > Could someone shed some light on this please? > > AFAIK: In most cases find_package(package_name) will fill ${package_name_LIBRARIES) with the full path of the libraries in which case you do not need the link_directories statement. Although in some cases this might not be true, and ${packag_name_LIBRARIES} only contains the libnames without any path which seems to be the case with orocos-kdl: taken from the orocos_kdl-config.cmake: message(" Includes in: ${orocos_kdl_INCLUDE_DIRS}") message( "Compiler flags: ${orocos_kdl_CFLAGS}") message(" Libraries: ${orocos_kdl_LIBRARIES}") message(" Libraries in: ${orocos_kdl_LIBRARY_DIRS}") message(" Linker flags : ${orocos_kdl_LD_FLAGS}") message(" Defines: ${orocos_kdl_DEFINES}") This is the result of the use of pkgconfig in the orocos_kdl-config.cmake to fill in these flags. If this is considered as a bug by someone please file a bug report on bugs.orocos.org to have it resolved ;) > Thanks again and sorry for the spam, > Marcus > > Ruben > > >> >> Thanks for reading, >> Marcus >> >> >> -- Ruben Smits, Phd Chief Technology Officer Intermodalics BVBA +32479511786 www.intermodalics.eu