osrf/icra2023_ros2_gz_tutorial

Docker instructions do not work on M1 Mac

playertr opened this issue · 1 comments

From a fresh clone on main (961d848), ./run.bash does not work on M1 mac. Output is as follows:

> pwd
/Users/timplayer/Documents/icra2023_ros2_gz_tutorial/docker
> ./run.bash osrf/icra2023_ros2_gz_tutorial:tutorial_no_nvidia --no-nvidia
osrf/icra2023_ros2_gz_tutorial:tutorial_no_nvidia
non-network local connections being added to access control list
docker: invalid reference format.
See 'docker run --help'.
non-network local connections being removed from access control list

When I run the command manually, I get further:

> docker run -it -e DISPLAY -e QT_X11_NO_MITSHM=1 -e XAUTHORITY=/tmp/.docker.xauth -v /tmp/.docker.xauth:/tmp/.docker.xauth -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro -v /dev/input:/dev/input --privileged --rm --security-opt seccomp=unconfined --ipc=host --network=host -v /Users/timplayer/.gitconfig:/home/developer/.gitconfig:ro "-e "ROS_DOMAIN_ID=0 "-e "ROS_LOCALHOST_ONLY=1 "-e "GZ_IP=127.0.0.1 "-e "GZ_RELAY=127.0.0.1 osrf/icra2023_ros2_gz_tutorial:tutorial_no_nvidia
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
~/docs.ros.org ~
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

developer@docker-desktop:~$ gz sim
Error setting socket option (IP_MULTICAST_IF).
Error setting socket option (IP_MULTICAST_IF).
Error setting socket option (IP_MULTICAST_IF).
Error setting socket option (IP_MULTICAST_IF).
Did you set the environment variable IGN_IP with a correct IP address?
  [172.17.0.1] seems an invalid local IP address.
  Using 127.0.0.1 as hostname.
terminate called after throwing an instance of 'std::out_of_range'
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
Error setting socket option (IP_MULTICAST_IF).
Error setting socket option (IP_MULTICAST_IF).
Error setting socket option (IP_MULTICAST_IF).
Error setting socket option (IP_MULTICAST_IF).
Did you set the environment variable IGN_IP with a correct IP address?
  [172.17.0.1] seems an invalid local IP address.
  Using 127.0.0.1 as hostname.
Stack trace (most recent call last):
#31   Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x4001c04d8f, in
#30   Object "gz sim server", at 0x400000117e, in
#29   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x400190ee19, in ruby_run_node
#28   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x400190b317, in
#27   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001aa030c, in rb_vm_exec
#26   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a9ac96, in
#25   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a97fc5, in
#24   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a95c34, in
#23   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x40019e1a1e, in
#22   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x400190c9ac, in rb_protect
#21   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001aa4c61, in rb_yield
#20   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001aa030c, in rb_vm_exec
#19   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a9ac96, in
#18   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a97fc5, in
#17   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a95c34, in
#16   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x400562044b, in
#15   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a63088, in rb_nogvl
#14   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x400561fd6b, in
#13   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x400564d492, in
#12   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x4005650e2d, in
#11   Object "/usr/lib/x86_64-linux-gnu/libgz-sim7-gz.so.7.5.0", at 0x4006103c2f, in runServer
terminate called after throwing an instance of 'std::out_of_range'
#10   Object "/lib/x86_64-linux-gnu/libgz-transport12.so.12", at 0x40068aec1f, in gz::transport::v12::Node::Node(gz::transport::v12::NodeOptions const&)
#9    Object "/lib/x86_64-linux-gnu/libgz-transport12.so.12", at 0x40068a40de, in
#8    Object "/lib/x86_64-linux-gnu/libgz-transport12.so.12", at 0x40068c6208, in gz::transport::v12::NodeShared::NodeShared()
#7    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x4005727512, in
#6    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x4005730517, in __cxa_throw
#5    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x40057302b6, in std::terminate()
#4    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x400573024b, in
#3    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x4005724bbd, in
#2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x4001c037f2, in abort
#1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x4001c1d475, in raise
#0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x4001c71a7c, in pthread_kill
Aborted (Signal sent by tkill() 40 1000)
qemu: uncaught target signal 6 (Aborted) - core dumped
  what():  vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)
Stack trace (most recent call last):
#31   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x400190ee19, in ruby_run_node
#30   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x400190b317, in
#29   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001aa030c, in rb_vm_exec
#28   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a9ac96, in
#27   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a97fc5, in
#26   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a95c34, in
#25   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x40019e1a1e, in
#24   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x400190c9ac, in rb_protect
#23   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001aa4c61, in rb_yield
#22   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001aa030c, in rb_vm_exec
#21   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a9ac96, in
#20   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a97fc5, in
#19   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a95c34, in
#18   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x400562044b, in
#17   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x4001a63088, in rb_nogvl
#16   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x400561fd6b, in
#15   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x400564d492, in
#14   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x4005650e2d, in
#13   Object "/usr/lib/x86_64-linux-gnu/libgz-sim7-gz.so.7.5.0", at 0x40060ff89f, in runGui
#12   Object "/lib/x86_64-linux-gnu/libgz-sim7-gui.so.7", at 0x40061ca7f5, in gz::sim::v7::gui::runGui(int&, char**, char const*, char const*, int, char const*)
#11   Object "/lib/x86_64-linux-gnu/libgz-sim7-gui.so.7", at 0x40061c7d95, in gz::sim::v7::gui::createGui(int&, char**, char const*, char const*, bool, char const*, int, char const*)
#10   Object "/lib/x86_64-linux-gnu/libgz-transport12.so.12", at 0x40068aec1f, in gz::transport::v12::Node::Node(gz::transport::v12::NodeOptions const&)
#9    Object "/lib/x86_64-linux-gnu/libgz-transport12.so.12", at 0x40068a40de, in
#8    Object "/lib/x86_64-linux-gnu/libgz-transport12.so.12", at 0x40068c6208, in gz::transport::v12::NodeShared::NodeShared()
#7    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x4005727512, in
#6    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x4005730517, in __cxa_throw
#5    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x40057302b6, in std::terminate()
#4    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x400573024b, in
#3    Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x4005724bbd, in
#2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x4001c037f2, in abort
#1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x4001c1d475, in raise
#0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x4001c71a7c, in pthread_kill
Aborted (Signal sent by tkill() 42 1000)
qemu: uncaught target signal 6 (Aborted) - core dumped
developer@docker-desktop:~$

We discussed a couple workarounds for M1 mac:

  • use a large VMWare fusion image and distribute via USB stick (with VMWare .iso)
  • Build the docker image with ARM64

These have pros and cons, including X server forwarding considerations.

At least partly addressed by #30