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

CMAKE_PREFIX_PATH package not found

asked 2018-10-05 15:32:06 -0600

borgman_jeremy gravatar image

updated 2018-10-06 06:51:04 -0600


I've been stuck on an issue in my ROS project after I started using an overlay. I used to just place all of my packages inside /src/ros2/<my_package> . I am trying to move my project into an overlay to make it more modular.

I have reduced my problem to just two packages. Package 1 is named "qualified_msgs" and builds with no issues. My second package is "ros_can_bridge" and this depends on the "qualified_msgs" package. My build process is as follows:

  1. Build qualified_msgs
  2. source /install/local_setup.bash (this should place the qualified_msgs cmake files in the path)
  3. Build ros_can_bridge

When I try to execute step I get the following error:

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

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


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

Failed   <<< ros_can_bridge [ Exited with code 1 ]

However, If I view my build log I can see that this is in the path:

Portion of Log:

Invoking command in '/home/ros/overlay/build/ros_can_bridge': /usr/bin/cmake /home/ros/overlay/ros_can_bridge -DCMAKE_TOOLCHAIN_FILE=/usr/ros2_ws/aarch64_toolchainfile.cmake -DTHIRDPARTY=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON -DCOMPILE_EXAMPLES=OFF -DCMAKE_C_STANDARD=99 -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING:BOOL=OFF -DCMAKE_PREFIX_PATH=/home/ros/overlay/install/qualified_msgs;/usr/ros2_ws/install/common_interfaces;/usr/ros2_ws/install/visualization_msgs;/usr/ros2_ws/install/ament_lint_common;/usr/ros2_ws/install/ament_cmake_uncrustify;/usr/ros2_ws/install/ament_uncrustify;/usr/ros2_ws/install/uncrustify_vendor;/usr/ros2_ws/install/trajectory_msgs;

I can see that my CMAKE files are indeed in this directory:

Folder Structureimage description

package.xml for ros_can_bridge:

<package format="3"> <name>ros_can_bridge</name> <version>0.0.2</version> <description>

</description> <maintainer email="">JB</maintainer> <license></license>


<build_depend>builtin_interfaces</build_depend> <build_depend>rosidl_default_generators</build_depend> <build_depend>rclcpp</build_depend> <build_depend>message_generation</build_depend> <build_depend>message_runtime</build_depend> <build_depend>std_msgs</build_depend> <build_depend>qualified_msgs</build_depend>

<exec_depend>builtin_interfaces</exec_depend> <exec_depend>rosidl_default_runtime</exec_depend> <exec_depend>message_runtime</exec_depend> <exec_depend>qualified_msgs</exec_depend>



<export> <build_type>ament_cmake</build_type> </export> </package>

Build Command:

colcon build \ --packages-select ros_can_bridge\ --cmake-force-configure \ --cmake-args \ " -DCMAKE_TOOLCHAIN_FILE=/usr/ros2_ws/aarch64_toolchainfile.cmake" \ " -DTHIRDPARTY=ON" \ " -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON" \ " -DBUILD_SHARED_LIBS=OFF" \ " -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON" \ " -DCOMPILE_EXAMPLES=OFF" \ " -DCMAKE_C_STANDARD=99" \ " -DCMAKE_BUILD_TYPE=Debug" \ " -DBUILD_TESTING:BOOL=OFF"

Any advice on this would be appreciated, I'm pretty stuck!


edit retag flag offensive close merge delete


Can you post the build commands used? My guess is that the dependency may be missing from the package.xml. There should be a line in ros_can_bridge/package.xml that looks like <depend>qualified_msgs</depend>.

jacobperron gravatar image jacobperron  ( 2018-10-05 19:54:03 -0600 )edit

You tagged this melodic, but your question is about ROS 2. Melodic is not a ROS 2 release.

Can I ask you to please fix the tagging?

Also: please attach your screenshot to this question directly. I've given you enough karma for that.

You could also consider using tree.

gvdhoorn gravatar image gvdhoorn  ( 2018-10-06 03:23:19 -0600 )edit

@jacobperron, Added the details of package.xml and clarifed the build command. Thanks for the help

@ gvdhoorn. Sorry about that, fixed the post

borgman_jeremy gravatar image borgman_jeremy  ( 2018-10-06 06:46:45 -0600 )edit

The problem might be in a part you haven't shared yet. Maybe you can share a SSCCE reproducing the problem.

Dirk Thomas gravatar image Dirk Thomas  ( 2018-10-08 10:39:06 -0600 )edit

@Dirk Thanks, as I was trying to reproduce the issue with the simplest example possible I found the problem. This build is in a crosscompiled environment and inside my toolchain file I had the line: set(CMAKE_FIND_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR}/install). This was overriding other CMAKe paths

borgman_jeremy gravatar image borgman_jeremy  ( 2018-10-09 11:44:03 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-09 11:45:09 -0600

borgman_jeremy gravatar image

updated 2018-10-10 01:36:01 -0600

gvdhoorn gravatar image

The root cause of this issue was related to my aarch64_toolchainfile.cmake file. This file had the line below:


This was overriding my other paths. Removing this line resolved the issue.

edit flag offensive delete link more


And a again a win for the MWE / SSCCE.

gvdhoorn gravatar image gvdhoorn  ( 2018-10-10 01:35:32 -0600 )edit

Question Tools

1 follower


Asked: 2018-10-05 15:32:06 -0600

Seen: 3,752 times

Last updated: Oct 10 '18