在 MacOS 上安装 ROS 2 时,我遇到了 Colcon 的一些问题。看来它使用了错误的Cmake路径。
跑步
colcon build --symlink-install --packages-skip-by-dep python_qt_binding
导致以下错误:
make: /opt/homebrew/Cellar/cmake/3.25.0/bin/cmake: No such file or directory
完整输出:
Starting >>> ament_package
Starting >>> ament_lint
Starting >>> gtest_vendor
Starting >>> fastcdr
Starting >>> ament_cppcheck
Starting >>> iceoryx_hoofs
Starting >>> osrf_pycommon
Starting >>> osrf_testing_tools_cpp
--- stderr: fastcdr
make: /opt/homebrew/Cellar/cmake/3.25.0/bin/cmake: No such file or directory
make: *** [cmake_check_build_system] Error 1
---
Failed <<< fastcdr [0.50s, exited with code 2]
Aborted <<< osrf_testing_tools_cpp [0.49s]
Aborted <<< osrf_pycommon [0.50s]
Aborted <<< ament_cppcheck [0.51s]
Aborted <<< ament_lint [0.53s]
Aborted <<< ament_package [0.54s]
Aborted <<< gtest_vendor [0.53s]
Aborted <<< iceoryx_hoofs [0.68s]
Summary: 0 packages finished [2.13s]
1 package failed: fastcdr
7 packages aborted: ament_cppcheck ament_lint ament_package gtest_vendor iceoryx_hoofs osrf_pycommon osrf_testing_tools_cpp
3 packages had stderr output: fastcdr gtest_vendor iceoryx_hoofs
310 packages not processed
[2.326s] ERROR:colcon.colcon_notification.desktop_notification.terminal_notifier:Could not find the colcon-terminal-notifier.app in the install prefix '/opt/homebrew'
正确的 Cmake 路径是:
>>> which cmake
/opt/homebrew/Cellar/cmake/3.26.0/bin/cmake
像这样设置正确的路径
set -x CMAKE_COMMAND /opt/homebrew/Cellar/cmake/3.26.0/bin
没有任何效果。