Ask Your Question
0

CMake can't find yaml-cpp on debian jessie

asked 2017-05-24 16:28:08 -0600

dpkoch gravatar image

updated 2017-05-24 16:29:25 -0600

I'm trying to release a new package on the ROS build farm, and the debian jessie build is currently failing due to the yaml-cpp dependency. I have it listed as a dependency in my package.xml:

<depend>yaml-cpp</depend>
and the relevant lines in my CMakeLists.txt are:
find_package(yaml-cpp REQUIRED)
catkin_package(
  ...
  DEPENDS YAML_CPP
)
include_directories(
  ${catkin_INCLUDE_DIRS}
  ${YAML_CPP_INCLUDE_DIR}
)
add_library(my_target ...)
target_link_libraries(my_target ${YAML_CPP_LIBRARIES})

On Ubuntu this builds just fine, both locally and on the ROS build farm. For the Debian Jessie build, however, I get the following error:

CMake Error at CMakeLists.txt:18 (find_package):
  By not providing "Findyaml-cpp.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "yaml-cpp",
  but CMake did not find one.

  Could not find a package configuration file provided by "yaml-cpp" with any
  of the following names:

    yaml-cppConfig.cmake
    yaml-cpp-config.cmake

  Add the installation prefix of "yaml-cpp" to CMAKE_PREFIX_PATH or set
  "yaml-cpp_DIR" to a directory containing one of the above files.  If
  "yaml-cpp" provides a separate development package or SDK, be sure it has
  been installed.


-- Configuring incomplete, errors occurred!

The rosdep dependency seems to be resolving just fine (It installs libyaml-cpp-dev properly and rosdep resolve yaml-cpp --os=debian:jessie returns as expected). However, it seems that either the CMake config file either isn't being installed or is not being found. I'm not sure what to do about this, especially since it works in Ubuntu.

The package that's failing is the "rosflight" package at https://github.com/rosflight/rosfligh... . If you're set up to run ROS prerelease tests, the error can be reproduced using the following commands:


mkdir -p /tmp/prerelease_job
cd /tmp/prerelease_job
generate_prerelease_script.py \
  https://raw.githubusercontent.com/ros-infrastructure/ros_buildfarm_config/production/index.yaml \
  kinetic default debian jessie amd64 \
  --custom-repo \
    rosflight:git:https://github.com/rosflight/rosflight-release.git:release/kinetic/rosflight/0.1.2-0 \
    rosflight_msgs:git:https://github.com/rosflight/rosflight-release.git:release/kinetic/rosflight_msgs/0.1.2-0 \
    rosflight_pkgs:git:https://github.com/rosflight/rosflight-release.git:release/kinetic/rosflight_pkgs/0.1.2-0 \
    rosflight_utils:git:https://github.com/rosflight/rosflight-release.git:release/kinetic/rosflight_utils/0.1.2-0 \
  --level 0 \
  --output-dir ./
./prerelease.sh

Any insights would be appreciated!

edit retag flag offensive close merge delete

Comments

Is yam-cpp a CMake package on Debian? I remember having to use PkgConfig like this:

find_package(PkgConfig REQUIRED)
pkg_check_modules(yaml_cpp REQUIRED yaml-cpp)
gvdhoorn gravatar imagegvdhoorn ( 2017-05-25 02:44:07 -0600 )edit

@gvdhoorn That appears to have resolved my issue, thanks! Switching to PkgConfig seems to work for both Ubuntu and Debian, although I did have to change from ${YAML_CPP_INCLUDE_DIR} to ${YAML_CPP_INCLUDEDIR} (I used a YAML_CPP prefix instead of yaml_cpp in pkg_check_modules()).

dpkoch gravatar imagedpkoch ( 2017-05-25 13:55:24 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-05-25 14:00:05 -0600

dpkoch gravatar image

updated 2017-05-25 14:01:37 -0600

As per @gvdhoorn's suggestion, this was resolved by switching to PkgConfig to find the module. So now instead of find_package(yaml_cpp REQUIRED) I have

find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)

I also needed to modify my include statement slightly to

include_directories(${YAML_CPP_INCLUDEDIR})

where before it was include_directories(${YAML_CPP_INCLUDE_DIR}).

This seems to work for both Debian and Ubuntu.

edit flag offensive delete link more

Comments

Ran into this issue building clearpathrobotics/pulson_ros, and this solution worked for us, too.

Rick Armstrong gravatar imageRick Armstrong ( 2017-07-13 21:24:27 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-05-24 16:28:08 -0600

Seen: 1,987 times

Last updated: May 25 '17