EQUIRED
cmake
build_error
ai_generated
true
CMake Error: find_package(ament_cmake REQUIRED) failed: ament_cmake not found
ID: cmake/ament-cmake-not-found
90%Fix Rate
92%Confidence
3Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3 | active | — | — | — |
Root Cause
CMake cannot find ament_cmake. ROS 2 environment not sourced or package not installed.
genericWorkarounds
-
95% success Source ROS 2 installation before cmake/colcon
source /opt/ros/humble/setup.bash && colcon build
Sources: https://cmake.org/cmake/help/latest/
-
90% success Install via apt
sudo apt install ros-humble-ament-cmake
-
85% success Add source to shell profile
echo 'source /opt/ros/humble/setup.bash' >> ~/.bashrc
Dead Ends
Common approaches that don't work:
-
Install ament_cmake via pip
90% fail
ament_cmake is CMake-based, distributed via apt, not pip
-
Add ament_cmake as git submodule
82% fail
Core ROS 2 infrastructure; source build causes version conflicts