Rosanswers logo


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:

ros_can_bridge 0.0.2 JB


<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>




Build Command:

colcon build
--packages-select ros_can_bridge
" -DCMAKE_TOOLCHAIN_FILE=/usr/ros2_ws/aarch64_toolchainfile.cmake"

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


Originally posted by borgman_jeremy on ROS Answers with karma: 56 on 2018-10-05

Post score: 1

Original comments

Comment by jacobperron on 2018-10-05:
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>.

Comment by gvdhoorn on 2018-10-06:
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.

Comment by borgman_jeremy on 2018-10-06:
@jacobperron, Added the details of package.xml and clarifed the build command. Thanks for the help

@ gvdhoorn. Sorry about that, fixed the post

Comment by Dirk Thomas on 2018-10-08:
The problem might be in a part you haven't shared yet. Maybe you can share a SSCCE reproducing the problem.

Comment by borgman_jeremy on 2018-10-09:
@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


1 Answer 1


Rosanswers logo

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.

Originally posted by borgman_jeremy with karma: 56 on 2018-10-09

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by gvdhoorn on 2018-10-10:
And a again a win for the MWE / SSCCE.


Your Answer

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