Skip to content

build: Compilation fixes for MinGW toolchain#374

Closed
ManManson wants to merge 3 commits intoValveSoftware:masterfrom
ManManson:mingw_build_fixes
Closed

build: Compilation fixes for MinGW toolchain#374
ManManson wants to merge 3 commits intoValveSoftware:masterfrom
ManManson:mingw_build_fixes

Conversation

@ManManson
Copy link
Copy Markdown
Contributor

@ManManson ManManson commented Apr 27, 2025

This changeset incorporates a few fixes for build errors and warnings found when building GNS via llvm-mingw toolchain:

  • TraceLoggingProvider: Disable for MinGW builds (MinGW-provided winapi headers differ from original WinSDK headers a lot, which poses a problem when trying to compile TraceLoggingProvider code)
  • build: Fix compilation errors for cmsghdr-related things in MinGW builds (MinGW requires to include a different header file + need to alias WSACMSGHDR* to CMSGHDR/cmsghdr to avoid compilation errors)
  • SteamNetworkingIPAddr: fix potentially dangerous -wcast-align warning in IsIPv6AllZeroes()

There are no `TraceLoggerProvider.h` or `winmeta.h` headers
in MinGW w32api package, so just disable the support for
TraceLoggerProvider interfaces.

Signed-off-by: Pavel Solodovnikov <pavel.al.solodovnikov@gmail.com>
…uilds

Signed-off-by: Pavel Solodovnikov <pavel.al.solodovnikov@gmail.com>
…ng in `IsIPv6AllZeroes()`

C-style cast from `uint8*` to `uint64*` is unsafe and can blow up
in cases when the source pointer is not aligned to `uint64` type
requirements.

Signed-off-by: Pavel Solodovnikov <pavel.al.solodovnikov@gmail.com>
@zpostfacto
Copy link
Copy Markdown
Contributor

Thanks! Sorry for the very slow reply. I merged almost all of these changes. I didn't merge the changes to steamnetworkingsockets_lowlevel.cpp because I think those functions should have stubs and don't need explicit surrounding guards. Let me know if I'm wrong.

@zpostfacto zpostfacto closed this Apr 15, 2026
@ManManson
Copy link
Copy Markdown
Contributor Author

It probably was due to missing WINEVENT_LEVEL_* declarations. So, instead of defining these, I decided to #ifdef the functions completely.

Although, it's not a big deal to provide a few extra defines. I'll revisit this a bit later and will provide a follow-up patch in case your changes aren't sufficient for a successful MinGW build.

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.

2 participants