Repository navigation
Prefer GLFW X11 backend when no Wayland display is set - #11
Merged
Merged
Conversation
GLFW >= 3.4 built with both Wayland and X11 probes Wayland first when XDG_SESSION_TYPE is unset. Inside Docker this makes libwayland print "error: XDG_RUNTIME_DIR is invalid or not set in the environment." before GLFW falls back to X11. Hint the X11 platform before glfwInit() when WAYLAND_DISPLAY is unset so the probe is skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The core library and libmujoco_ros2_control_plugins_impl.so can each carry their own statically linked GLFW (e.g. Bazel builds against BCR glfw 3.4), so the init hint set in MujocoSimulation does not reach the camera plugin's glfwInit() and the XDG_RUNTIME_DIR error is printed a second time. Move the helper into a shared header and call it before both glfwInit() sites. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lgulich
added a commit
that referenced
this pull request
Oct 7, 2026
…pedance Prefer GLFW X11 backend when no Wayland display is set (cherry-pick #11)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Inside Docker,
ros2_control_nodeprints a spurious error twice at startup:GLFW >= 3.4 built with both Wayland and X11 (e.g. Bazel builds using BCR
glfw 3.4.0) falls back to probing platforms in order whenXDG_SESSION_TYPEis unset, and Wayland comes first. libwayland prints the error, then GLFW falls back to X11 and everything works.The core library and
libmujoco_ros2_control_plugins_impl.socan each carry their own statically linked GLFW, so the init hint must be set from both:Compiled out on GLFW < 3.4 (Ubuntu's system
libglfw33.3 is X11-only anyway).Evidence
Bazel build of
unitree_g1_bringup unitree_g1_controller_manager.launch.py hardware_type:=mujoco initial_controller_group:=agile_velocity, env stripped like a container (env -u XDG_RUNTIME_DIR -u XDG_SESSION_TYPE -u WAYLAND_DISPLAY), real X display:grep -c 'XDG_RUNTIME_DIR is invalid'→2(viewer + camera plugin)After:
grep -c 'XDG_RUNTIME_DIR is invalid'→0; viewer starts, camera rendering loop starts, controllers switch successfully.Also verified in a release-2026.09
isaac-ros activatecontainer (Ubuntu 24.04,ROS_DISTRO=lyrical, noXDG_RUNTIME_DIR/XDG_SESSION_TYPE/WAYLAND_DISPLAY) withros-lyrical-unitree-g1-bringupinstalled from the release snapshot, running the tutorial launch command:ros-lyrical-mujoco-ros2-control{,-plugins}):XDG_RUNTIME_DIR is invalid→2After (same packages rebuilt with this change): →
0; controllers switch successfully in both runs.pre-commitpasses.Merge Danger
Door: two-way
Blast Radius: small
Only affects GLFW platform selection when
WAYLAND_DISPLAYis unset. Real Wayland sessions (which setWAYLAND_DISPLAY) keep GLFW's default auto-detection.🤖 Generated with Claude Code