osrf / rocker

A tool to run docker containers with overlays and convenient options for things like GUIs etc.
Apache License 2.0
574 stars 75 forks source link

macOS Compatibility #165

Open rgov opened 2 years ago

rgov commented 2 years ago

Rocker 0.2.7 is not compatible with macOS. If you came here to report a problem, consider it unnecessary.


The current issues I've identified on macOS Monterrey are:

  1. ERROR: test_pulse_extension (test_extension.PulseExtensionTest)

    The proximate cause of the error is that macOS doesn't have an audio group. Even if this were the case, though, the volume mapping etc. would not work. It is possible to achieve forwarding of audio from a container to the host but it would require significant changes to the extension.

  2. FAIL: test_git_extension (test_git_extension.GitExtensionTest)

    The test is flawed in that it assumes that

    user_gitconfig_target = os.path.expanduser('~/.gitconfig')

    will result in a path like /home/user/.gitconfig but on macOS it resolves to /Users/user/.gitconfig. This can easily be resolved.

  3. FAIL: test_x11_xpdyinfo (test_nvidia.X11Test)

    You cannot mount the Unix sockets under /tmp/.X11-unix into the container because Docker for Mac doesn't support sharing Unix sockets. (Providing the volume mount seems harmless nonetheless.) Instead we need to send the environment variable DISPLAY=host.docker.internal:0 to the container and have it connect over the network. (Details on configuring XQuartz or Xauthority omitted here.)

  4. FAIL: test_nvidia_glmark2 (test_nvidia.NvidiaTest)

    Nvidia GPUs are no longer supported on macOS, however in theory you should be able to point Docker's backend to a remote Linux server that does have a GPU, so a simple platform check isn't sufficient here.

  5. OpenGL support in XQuartz

    I added a snippet for the X11 extension that installs the OpenGL SW renderer to the container image:

    RUN apt-get update \
        && apt-get install -y mesa-utils libgl1-mesa-glx \
        && apt-get clean
    
    ENV LIBGL_ALWAYS_INDIRECT=1

    Then enabled OpenGL drawing in XQuartz with defaults write org.xquartz.X11 enable_iglx -bool true per this answer. This gets us further, but rviz2 for example generates:

    [rviz2-4] [ERROR] [rviz2]: RenderingAPIException: OpenGL 1.5 is not supported in GLRenderSystem::initialiseContext at /tmp/binarydeb/ros-eloquent-rviz-ogre-vendor-7.0.3/obj-x86_64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GL/src/OgreGLRenderSystem.cpp (line 1203)
tfoote commented 2 years ago

Thanks for detailing out these issues. PRs that improve support for any of these corners would be appreciated. I don't have a macOS machine to develop or test on, but am happy to consider any improvements in cross platform support that doesn't regress the main functionality.

rgov commented 2 years ago

I spent a while trying to get VirtualGL to work unsuccessfully but perhaps that is the right way?