macOS support in ROS 2 Galactic and beyond

I am afraid I don’t have the time to maintain the macOS builds, but I would be sad to see it relegated to a secondary status. I know my sadness isn’t enough for finding the resources one needs to do the work, though … (Perhaps dropping Windows could help? Frees up resources and brings world peace a bit closer :wink:)

The GUIs are indeed quite problematic, but perhaps it could remain tier-1 for at least the non-GUI parts? Those work ok on the latest macOS and with SIP enabled, even if there are some complications caused by SIP for the python tests.

Regarding a port to the Apple M1, I’d say the first signs are positive. In case anyone wants to give it a go, below is roughly what it took for me to get test_communication and test_rclcpp up with Cyclone DDS. No guarantee that these notes are entirely correct, but they should be close enough for the intrepid and curious:

Install homebrew (in /opt/homebrew, following the recommendation for doing a native M1 homebrew installation)

brew edit graphviz -> drop librsvg
* works around “brew install rust” failing (rustup will install a working compiler, but I don't know how to make homebrew use it)

install ROS2 dependencies
* most of them anyway (I haven’t tried Qt or other similarly complicated things)
* don’t bother disabling SIP, there’s no real need

git clone https://github.com/numpy/numpy.git
cd numpy
pip3 install . --no-binary :all: --no-use-pep517
(see https://github.com/numpy/numpy/issues/17807#issuecomment-733863375; better do it outside ros2_ws)

Edit src/osrf/osrf_testing_tools_cpp/osrf_testing_tools_cpp/src/memory_tools/vendor/bombela/backward-cpp/backward.hpp
  #elif defined(__aarch64__) -> add && !defined(__APPLE__)
add another case
  #elif defined(__APPLE__) && defined(__aarch64__)
  error_addr = reinterpret_cast<void *>(uctx->uc_mcontext->__ss.__pc);
(no idea if that suffices to make it work, but it builds)

Start the build:

colcon build --packages-up-to rmw_cyclonedds_cpp test_communication test_rclcpp --cmake-args -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH=`brew --prefix` -DOPENSSL_ROOT_DIR=`brew --prefix openssl`

This will fail because of an issue in "mimick", but the sources only show up during the build. Edit:

build/mimick_vendor/mimick-ext-prefix/src/mimick-ext/src/asm/trampoline-aarch64.S
* add .align4 for mmk_trampoline, mmk_trampoline_end
* prefix mmk_trampoline and mmk_trampoline_end with an “_”

then restart the build.
3 Likes