ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

CMake can't find yaml-cpp on debian jessie

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

dpkoch gravatar image

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

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:

and the relevant lines in my CMakeLists.txt are:
find_package(yaml-cpp REQUIRED)
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:


  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 . 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 \ \
  kinetic default debian jessie amd64 \
  --custom-repo \
    rosflight:git: \
    rosflight_msgs:git: \
    rosflight_pkgs:git: \
    rosflight_utils:git: \
  --level 0 \
  --output-dir ./

Any insights would be appreciated!

edit retag flag offensive close merge delete


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 image gvdhoorn  ( 2017-05-25 02:44:07 -0500 )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 image dpkoch  ( 2017-05-25 13:55:24 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

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

dpkoch gravatar image

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

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


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


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

Rick Armstrong gravatar image Rick Armstrong  ( 2017-07-13 21:24:27 -0500 )edit

Question Tools



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

Seen: 8,104 times

Last updated: May 25 '17