ENT-13766: Fix MinGW cross-compilation: ws2_32 linkage and snprintf C99 detection#6053
Open
larsewi wants to merge 1 commit intocfengine:masterfrom
Open
ENT-13766: Fix MinGW cross-compilation: ws2_32 linkage and snprintf C99 detection#6053larsewi wants to merge 1 commit intocfengine:masterfrom
larsewi wants to merge 1 commit intocfengine:masterfrom
Conversation
When cross-compiling for MinGW with GCC 13 / mingw-w64 v11: 1. AC_SEARCH_LIBS(setsockopt, socket) didn't find setsockopt because on MinGW it lives in ws2_32, not socket. This caused AC_REPLACE_FUNCS to compile replacement inet_ntop/inet_pton that conflict with the MinGW-w64 declarations (socklen_t vs size_t parameter types). Fix: search [socket ws2_32] so -lws2_32 is in LIBS. 2. HW_FUNC_VSNPRINTF/HW_FUNC_SNPRINTF use AC_RUN_IFELSE to test C99 compliance, which can't execute when cross-compiling, defaulting to "no". This caused #define vfprintf rpl_vfprintf etc., which conflicts with mingw-w64 v11 inline stdio functions. Fix: default to C99-compliant for mingw* targets in cross-compile. Ticket: ENT-13766 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
When cross-compiling for MinGW with GCC 13 / mingw-w64 v11:
AC_SEARCH_LIBS(setsockopt, socket) didn't find setsockopt because on
MinGW it lives in ws2_32, not socket. This caused AC_REPLACE_FUNCS to
compile replacement inet_ntop/inet_pton that conflict with the
MinGW-w64 declarations (socklen_t vs size_t parameter types).
Fix: search [socket ws2_32] so -lws2_32 is in LIBS.
HW_FUNC_VSNPRINTF/HW_FUNC_SNPRINTF use AC_RUN_IFELSE to test C99
compliance, which can't execute when cross-compiling, defaulting to
"no". This caused #define vfprintf rpl_vfprintf etc., which conflicts
with mingw-w64 v11 inline stdio functions.
Fix: default to C99-compliant for mingw* targets in cross-compile.
Ticket: ENT-13766
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com