Skip to content

Comments

Fix MinGW stat redefinition and thread-safe localtime#3084

Open
Ashutosh0x wants to merge 1 commit intogoogle-deepmind:mainfrom
Ashutosh0x:fix/mingw-stat-localtime
Open

Fix MinGW stat redefinition and thread-safe localtime#3084
Ashutosh0x wants to merge 1 commit intogoogle-deepmind:mainfrom
Ashutosh0x:fix/mingw-stat-localtime

Conversation

@Ashutosh0x
Copy link
Contributor

This Pull Request addresses POSIX compatibility and thread-safety issues when building with MinGW-w64.

Changes

  • Wrapped the #define stat _stat definition in !defined(MINGW32). MinGW-w64 provides its own POSIX-compliant stat implementation, and forcing the MSVC-style redefinition causes conflict.
  • Replaced the _MSC_VER check with defined(_WIN32) when selecting localtime_s. MinGW provides the Windows-native thread-safe localtime_s function but does not define _MSC_VER.

Fixes #3038 and #3037

- Guard #define stat _stat with !defined(__MINGW32__) to avoid conflicts with MinGW's own POSIX-compliant stat implementation

- Replace _MSC_VER check with defined(_WIN32) for localtime_s to allow all Windows compilers including MinGW to use the secure function

Fixes google-deepmind#3038, google-deepmind#3037
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.

Compiling mujoco with MinGW fails because of redefined stat

2 participants