Skip to content

Fix MinGW stack flag syntax and Python binding crashes#3083

Merged
copybara-service[bot] merged 1 commit intogoogle-deepmind:mainfrom
Ashutosh0x:fix/mingw-linker-stack
Feb 18, 2026
Merged

Fix MinGW stack flag syntax and Python binding crashes#3083
copybara-service[bot] merged 1 commit intogoogle-deepmind:mainfrom
Ashutosh0x:fix/mingw-linker-stack

Conversation

@Ashutosh0x
Copy link
Contributor

This Pull Request addresses issues with linker flag syntax on MinGW and prevents crashes when loading MuJoCo as a Python module on Windows.

Changes

  • Updated MujocoLinkOptions.cmake to detect the linker type. It now uses /STACK:16777216 for lld-link and --stack,16777216 for the standard MinGW ld linker.
  • Filtered out stack-related flags from the Python binding modules. Applying stack size to a shared library (DLL) is non-standard on Windows and causes immediate crashes in the Python interpreter.

Fixes #3011

@Ashutosh0x Ashutosh0x force-pushed the fix/mingw-linker-stack branch from c453320 to 975d8c0 Compare February 11, 2026 22:31
Ashutosh0x added a commit to Ashutosh0x/mujoco that referenced this pull request Feb 11, 2026
@mmossg
Copy link
Collaborator

mmossg commented Feb 18, 2026

I think to make import/copybara happy, the cmake/MujocoLinkOptions.cmake changes also need to be replicated in simulate/cmake/MujocoLinkOptions.cmake and sample/cmake/MujocoLinkOptions.cmake.

@Ashutosh0x Ashutosh0x force-pushed the fix/mingw-linker-stack branch from 04c7d09 to e588948 Compare February 18, 2026 08:51
@Ashutosh0x
Copy link
Contributor Author

@mmossg Done, thanks! Replicated the changes to simulate and sample folders.

- Detect linker type (lld-link vs ld) and use the appropriate stack flag: /STACK:16777216 for lld-link, --stack,16777216 for MinGW ld

- Filter out stack-related flags from Python binding modules to prevent crashes when loading MuJoCo as a DLL in Python

Fixes google-deepmind#3011
@Ashutosh0x Ashutosh0x force-pushed the fix/mingw-linker-stack branch from e588948 to 50349dc Compare February 18, 2026 08:53
@copybara-service copybara-service bot merged commit 7d3e1ab into google-deepmind:main Feb 18, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Increase Windows stack" Patch in 3.4.0 breaks the mujoco python binding in Windows

2 participants