CMAKE_PREFIX_PATH package not found
Hello,
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:
- Build qualified_msgs
- source /install/local_setup.bash (this should place the qualified_msgs cmake files in the path)
- 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:
qualified_msgsConfig.cmake
qualified_msgs-config.cmake
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 Structure
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>
<buildtool_depend>ament_cmake</buildtool_depend>
<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>
<test_depend>ament_lint_common</test_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<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!
Thanks,
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 inros_can_bridge/package.xml
that looks like<depend>qualified_msgs</depend>
.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
.@jacobperron, Added the details of package.xml and clarifed the build command. Thanks for the help
@ gvdhoorn. Sorry about that, fixed the post
The problem might be in a part you haven't shared yet. Maybe you can share a SSCCE reproducing the problem.
@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