Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake error trying to find_package(witmotion_ros REQUIRED) #39

Open
TagirAbuziarov opened this issue Mar 11, 2024 · 2 comments
Open

CMake error trying to find_package(witmotion_ros REQUIRED) #39

TagirAbuziarov opened this issue Mar 11, 2024 · 2 comments

Comments

@TagirAbuziarov
Copy link

TagirAbuziarov commented Mar 11, 2024

I'm working with WT901 module using docker image of ROS2 Iron and witmotion_ros (ros2 branch). witmotion_ros package works fine but when I try to specify witmotion_ros package as a dependency of my custom package I get an CMake error:

root@dc29fda62103:/ros2_ws# colcon build --packages-select test_dep
Starting >>> test_dep
--- stderr: test_dep                         
CMake Error at /ros2_ws/install/witmotion_ros/share/witmotion_ros/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package):
  Found package configuration file:

    /ros2_ws/install/witmotion_ros/share/witmotion_ros/cmake/witmotion_rosConfig.cmake

  but it set witmotion_ros_FOUND to FALSE so package "witmotion_ros" is
  considered to be NOT FOUND.
Call Stack (most recent call first):
  /ros2_ws/install/witmotion_ros/share/witmotion_ros/cmake/witmotion_rosConfig.cmake:41 (include)
  CMakeLists.txt:10 (find_package)


CMake Error at CMakeLists.txt:10 (find_package):
  Found package configuration file:

    /ros2_ws/install/witmotion_ros/share/witmotion_ros/cmake/witmotion_rosConfig.cmake

  but it set witmotion_ros_FOUND to FALSE so package "witmotion_ros" is
  considered to be NOT FOUND.


---
Failed   <<< test_dep [3.56s, exited with code 1]

Summary: 0 packages finished [5.05s]
  1 package failed: test_dep
  1 package had stderr output: test_dep

How to reproduce:

  1. Run Docker ROS2 Iron image
  2. Create ROS2 workspace directory /ros2_ws and src directory:
mkdir -p /ros2_ws/src
  1. Clone witmotion_ros (ros2 branch) following the README.md https://github.com/ElettraSciComp/witmotion_IMU_ros/tree/ros2
  2. Modify CMakeLists.txt so it can be built with ROS2 Iron (hardcoded humble and it can not find tf2_geometry_msgs)
# (otherwise there will be fatal error:
# tf2_geometry_msgs/tf2_geometry_msgs.hpp: No such file or directory)
sed -i -e 's/include_directories(\/opt\/ros\/humble\/include\/tf2_geometry_msgs)/include_directories(\/opt\/ros\/iron\/include\/tf2_geometry_msgs)/' \
  /ros2_ws/src/witmotion_ros/CMakeLists.txt

and build it

colcon build --packages-select witmotion_ros
  1. Create custom package "test_dep" using witmotion as dependency:
cd /ros2_ws/src && ros2 pkg create test_dep --dependencies witmotion_ros
  1. Build test_dep package
cd /ros2_ws
colcon build --packages-select test_dep
@lolddohaja
Copy link

I resolved the find_package(witmotion_ros REQUIRED) error by making necessary modifications to the CMakeLists.txt. This approach successfully addressed the issue without needing to refer to the changes in PR #40.

@TagirAbuziarov
Copy link
Author

TagirAbuziarov commented Apr 23, 2024

I still can reproduce the issue, using both original repo and PR #40 alternately with steps described above (except modifying CMakeLists.txt in step 4, it fixed). Am I doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants