0
$\begingroup$

Rosanswers logo

I'm following the documentation to build a package that exports C++ headers and a library ( http://ros.org/doc/groovy/api/catkin/html/howto/building_libraries.html ).

It builds fine with catkin_make, but dependent packages to build with catkin_make_isolated. What am I doing wrong?

My CMakeLists.txt contains:

# http://ros.org/doc/groovy/api/catkin/html/user_guide/supposed.html
cmake_minimum_required(VERSION 2.8.3)
project(pr2_mechanism_model)

# Load catkin and all dependencies required for this package
find_package(catkin REQUIRED COMPONENTS roscpp pr2_hardware_interface urdf urdfdom kdl_parser pluginlib angles hardware_interface rostest rosunit)

find_package(Eigen REQUIRED)
include_directories(SYSTEM ${EIGEN_INCLUDE_DIRS})
include_directories(include ${catkin_INCLUDE_DIRS})

add_library( pr2_mechanism_model
  src/joint.cpp
  src/robot.cpp
  src/chain.cpp
  src/tree.cpp
  src/simple_transmission.cpp
  src/pr2_gripper_transmission.cpp
  src/wrist_transmission.cpp
  src/pr2_belt_transmission.cpp
  src/joint_calibration_simulator.cpp
)

catkin_package(
    DEPENDS tinyxml urdfdom
    CATKIN_DEPENDS roscpp pr2_hardware_interface urdf kdl_parser pluginlib angles hardware_interface
    INCLUDE_DIRS include
    LIBRARIES pr2_mechanism_model
)
    
install(DIRECTORY include/${PACKAGE_NAME}/
   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION})

install(TARGETS pr2_mechanism_model
   RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION})

The package itself builds fine, but any package that tries to find_package() it fails to build under catkin_make_isolated with an error like:

==> Processing catkin package: 'pr2_controller_interface'
==> Building with env: '/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_mechanism_model/env.sh'
==> cmake /wg/stor2a/ahendrix/hydro/src/pr2_mechanism/pr2_controller_interface -DCATKIN_DEVEL_PREFIX=/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_controller_interface -DCMAKE_INSTALL_PREFIX=/wg/stor2a/ahendrix/hydro/install_isolated in '/wg/stor2a/ahendrix/hydro/build_isolated/pr2_controller_interface'
-- Using CATKIN_DEVEL_PREFIX: /wg/stor2a/ahendrix/hydro/devel_isolated/pr2_controller_interface
-- Using CMAKE_PREFIX_PATH: /wg/stor2a/ahendrix/hydro/devel_isolated/pr2_mechanism_model;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_mechanism;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_machine;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_hardware_interface;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_description;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_dashboard_aggregator;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_common;/wg/stor2a/ahendrix/hydro/devel_isolated/position_controllers;/wg/stor2a/ahendrix/hydro/devel_isolated/map_msgs;/wg/stor2a/ahendrix/hydro/devel_isolated/forward_command_controller;/wg/stor2a/ahendrix/hydro/devel_isolated/controller_interface;/wg/stor2a/ahendrix/hydro/devel_isolated/hardware_interface;/wg/stor2a/ahendrix/hydro/devel_isolated/controllers_msgs;/wg/stor2a/ahendrix/hydro/devel_isolated/controller_manager_msgs;/wg/stor2a/ahendrix/hydro/devel_isolated/control_toolbox;/wg/stor2a/ahendrix/hydro/devel_isolated/audio_play;/wg/stor2a/ahendrix/hydro/devel_isolated/audio_capture;/wg/stor2a/ahendrix/hydro/devel_isolated/audio_common_msgs;/wg/stor2a/ahendrix/hydro/devel_isolated/audio_common;/opt/ros/hydro
-- This workspace overlays: /wg/stor2a/ahendrix/hydro/devel_isolated/pr2_mechanism_model;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_mechanism;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_machine;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_hardware_interface;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_description;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_dashboard_aggregator;/wg/stor2a/ahendrix/hydro/devel_isolated/pr2_common;/wg/stor2a/ahendrix/hydro/devel_isolated/position_controllers;/wg/stor2a/ahendrix/hydro/devel_isolated/map_msgs;/wg/stor2a/ahendrix/hydro/devel_isolated/forward_command_controller;/wg/stor2a/ahendrix/hydro/devel_isolated/controller_interface;/wg/stor2a/ahendrix/hydro/devel_isolated/hardware_interface;/wg/stor2a/ahendrix/hydro/devel_isolated/controllers_msgs;/wg/stor2a/ahendrix/hydro/devel_isolated/controller_manager_msgs;/wg/stor2a/ahendrix/hydro/devel_isolated/control_toolbox;/wg/stor2a/ahendrix/hydro/devel_isolated/audio_play;/wg/stor2a/ahendrix/hydro/devel_isolated/audio_capture;/wg/stor2a/ahendrix/hydro/devel_isolated/audio_common_msgs;/wg/stor2a/ahendrix/hydro/devel_isolated/audio_common;/opt/ros/hydro
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using CATKIN_TEST_RESULTS_DIR: /wg/stor2a/ahendrix/hydro/build_isolated/pr2_controller_interface/test_results
-- catkin 0.5.67
CMake Error at /wg/stor2a/ahendrix/hydro/devel_isolated/pr2_mechanism_model/share/pr2_mechanism_model/cmake/pr2_mechanism_modelConfig.cmake:127 (message):
  Project 'pr2_controller_interface' tried to find library
  'pr2_mechanism_model'.  The library is neither a target nor built/installed
  properly.  Did you compile project 'pr2_mechanism_model'? Did you
  find_package() it before the subdirectory containing its code is included?
Call Stack (most recent call first):
  /opt/ros/hydro/share/catkin/cmake/catkinConfig.cmake:72 (find_package)
  CMakeLists.txt:4 (find_package)

I've confirmed that the pr2_mechanism_model library is compiled to build_isolated/pr2_mechanism_model/libpr2_mechanism_model.so


Originally posted by ahendrix on ROS Answers with karma: 47576 on 2013-06-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Your library ends up in the wrong location under build - it should be under devel/lib.

The reason is that you invoke catkin_package after add_library. catkin_package sets the default destination for all kind of targets and must therefore be called before add_library.


Originally posted by Dirk Thomas with karma: 16276 on 2013-06-27

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.