ROS 2をM2 mac miniにインストールする
System requirements
We currently support macOS Mojave (10.14).
とりあえず最初の方はこのドキュメントに書かれている通りの手順で問題なさそう
こちらも参考にしつつ
brewで色々インストール
brew install asio assimp bison bullet cmake console_bridge cppcheck \
cunit eigen freetype graphviz opencv openssl orocos-kdl pcre poco \
pyqt5 python qt@5 sip spdlog osrf/simulation/tinyxml1 tinyxml2
勝手にインストールされてしまうPython3.12をアンインストール
brew uninstall --ignore-dependencies python@3.12
pipをインストール
python3 -m pip install -U pip
pipで依存関係をインストールしようとしたら、
python3 -m pip install -U \
argcomplete catkin_pkg colcon-common-extensions coverage \
cryptography empy flake8 flake8-blind-except==0.1.1 flake8-builtins \
flake8-class-newline flake8-comprehensions flake8-deprecated \
flake8-docstrings flake8-import-order flake8-quotes \
importlib-metadata jsonschema lark==1.1.1 lxml matplotlib mock mypy==0.931 netifaces \
nose pep8 psutil pydocstyle pydot pygraphviz pyparsing==2.4.7 \
pytest-mock rosdep rosdistro setuptools==59.6.0 vcstool
エラーが出てきた
ERROR: Could not build wheels for pygraphviz, which is required to install pyproject.toml-based projects
python -m pip install \
--global-option=build_ext \
--global-option="-I$(brew --prefix graphviz)/include/" \
--global-option="-L$(brew --prefix graphviz)/lib/" \
pygraphviz
を実行するように言われているけど、同様のエラーが出た
Failed to build pygraphviz
ERROR: Could not build wheels for pygraphviz, which is required to install pyproject.toml-based projects
こちらのコメントの通りにやったら pygraphviz
のインストールは成功した
python3 -m pip install \
--config-settings="--global-option=build_ext" \
--config-settings="--global-option=-I$(brew --prefix graphviz)/include/" \
--config-settings="--global-option=-L$(brew --prefix graphviz)/lib/" \
pygraphviz
今度は成功した
python3 -m pip install -U \
argcomplete catkin_pkg colcon-common-extensions coverage \
cryptography empy flake8 flake8-blind-except==0.1.1 flake8-builtins \
flake8-class-newline flake8-comprehensions flake8-deprecated \
flake8-docstrings flake8-import-order flake8-quotes \
importlib-metadata jsonschema lark==1.1.1 lxml matplotlib mock mypy==0.931 netifaces \
nose pep8 psutil pydocstyle pydot pygraphviz pyparsing==2.4.7 \
pytest-mock rosdep rosdistro setuptools==59.6.0 vcstool
ビルド結果
Summary: 82 packages finished [49.0s]
1 package failed: rviz_ogre_vendor
5 packages aborted: foonathan_memory_vendor ignition_math6_vendor mcap_vendor uncrustify_vendor yaml_cpp_vendor
88 packages had stderr output: ament_clang_format ament_clang_tidy ament_cmake ament_cmake_auto ament_cmake_clang_format ament_cmake_clang_tidy ament_cmake_copyright ament_cmake_core ament_cmake_cppcheck ament_cmake_cpplint ament_cmake_export_definitions ament_cmake_export_dependencies ament_cmake_export_include_directories ament_cmake_export_interfaces ament_cmake_export_libraries ament_cmake_export_link_flags ament_cmake_export_targets ament_cmake_flake8 ament_cmake_gen_version_h ament_cmake_gmock ament_cmake_google_benchmark ament_cmake_gtest ament_cmake_include_directories ament_cmake_libraries ament_cmake_lint_cmake ament_cmake_mypy ament_cmake_nose ament_cmake_pclint ament_cmake_pep257 ament_cmake_pycodestyle ament_cmake_pyflakes ament_cmake_pytest ament_cmake_python ament_cmake_target_dependencies ament_cmake_test ament_cmake_vendor_package ament_cmake_version ament_cmake_xmllint ament_copyright ament_cppcheck ament_cpplint ament_flake8 ament_index_python ament_lint ament_lint_auto ament_lint_cmake ament_mypy ament_package ament_pclint ament_pep257 ament_pycodestyle ament_pyflakes ament_xmllint domain_coordinator eigen3_cmake_module fastcdr foonathan_memory_vendor gmock_vendor gtest_vendor ignition_cmake2_vendor ignition_math6_vendor launch launch_pytest launch_testing launch_xml launch_yaml libcurl_vendor mcap_vendor osrf_pycommon osrf_testing_tools_cpp pybind11_vendor ros_environment rosidl_cli rpyutils rviz_assimp_vendor rviz_ogre_vendor shared_queues_vendor sqlite3_vendor test_interface_files test_osrf_testing_tools_cpp tinyxml2_vendor tinyxml_vendor tracetools_read tracetools_trace uncrustify_vendor urdfdom_headers yaml_cpp_vendor zstd_vendor
248 packages not processed
[49.221s] ERROR:colcon.colcon_notification.desktop_notification.terminal_notifier:Could not find the colcon-terminal-notifier.app in the install prefix '/opt/homebrew'
rviz_ogre_vendor
のビルドに失敗している
ここでコケた模様
--- stderr: rviz_ogre_vendor
CMake Warning:
Manually-specified variables were not used by the project:
THIRDPARTY
patch: **** malformed patch at line 1817:
make[2]: *** [ogre-v1.12.1-prefix/src/ogre-v1.12.1-stamp/ogre-v1.12.1-patch] Error 2
make[1]: *** [CMakeFiles/ogre-v1.12.1.dir/all] Error 2
make: *** [all] Error 2
---
Failed <<< rviz_ogre_vendor [8.65s, exited with code 2]
このPRを参考に、 ros2_m1_native/src/ros2/rviz/rviz_ogre_vendor/pragma-patch.diff
の1817行目と1824行目にスペースを追加したら、 patch: **** malformed patch at line 1817:
のエラーは出なくなった
しかし依然として以下のエラーは出ている
make[2]: *** [ogre-v1.12.1-prefix/src/ogre-v1.12.1-stamp/ogre-v1.12.1-patch] Error 1
make[1]: *** [CMakeFiles/ogre-v1.12.1.dir/all] Error 2
make: *** [all] Error 2
同じPRを参考に ros2_m1_native/src/ros2/rviz/rviz_ogre_vendor/CMakeFile.txt
の191行目も変更したら、出るエラーが変わった
fatal error: 'Availability.h' file not found
以下のコマンドを実行したら、
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
次に出てきたエラー
--- stderr: urdfdom_headers
You have not agreed to the Xcode license agreements. Please run 'sudo xcodebuild -license' from within a Terminal window to review and agree to the Xcode and Apple SDKs license.
---
Failed <<< urdfdom_headers [10.3s, exited with code 69]
言われたとおりに以下を実行し、指示通りに進める
sudo xcodebuild -license
そしてビルドをリトライしたが再び 'Availability.h' file not found
が出た
どうやらROS公式ではmacOSはサポートされていないようですが、頑張ればできるみたいなのでやってみます
XcodeもHomebrewもインストールしてなかったので、まずそれらをインストールするところから