ros2
build_error
ai_generated
true
colcon build: CMake错误在CMakeLists.txt: 找不到catkin包
colcon build: CMake Error at CMakeLists.txt: find_package(catkin) failed
ID: ros2/colcon-build-catkin-package-not-found
85%修复率
88%置信度
1证据数
2023-03-15首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| ROS2 Humble (Ubuntu 22.04) | active | — | — | — |
| ROS2 Iron (Ubuntu 22.04) | active | — | — | — |
| ROS2 Rolling (Ubuntu 24.04) | active | — | — | — |
根因分析
在ROS2工作空间中构建ROS1(catkin)包,但catkin不可用或工作空间未配置为混合构建。
English
A ROS1 (catkin) package is being built in a ROS2 workspace, but catkin is not available or the workspace is not configured for mixed builds.
官方文档
https://docs.ros.org/en/humble/Tutorials/Intermediate/URDF/URDF-Main.html解决方案
-
从工作空间中移除catkin包,或将其迁移到ament_cmake。如果需要ROS1兼容性,请使用单独的catkin工作空间,并在构建ROS2工作空间前source它。
-
使用colcon的--merge-install或--cmake-args包含catkin工作空间:colcon build --cmake-args -DCATKIN_DEVEL_PREFIX=/path/to/catkin_ws/devel
无效尝试
常见但无效的做法:
-
Install catkin via apt and rebuild
90% 失败
catkin is not a ROS2 package; even if installed, colcon won't find it without ROS1 bridge setup.
-
Manually set CMAKE_PREFIX_PATH to catkin workspace
85% 失败
colcon ignores manual CMAKE_PREFIX_PATH overrides for workspace isolation.