On 09/06/2025 19:54, Jeremy Drake via Cygwin-patches wrote:
On Mon, 9 Jun 2025, Radek Barton via Cygwin-patches wrote:
Hello
Since today, https://github.com/cygwin/cygwin/actions/runs/15537033468 workflow
started to fail as it seems that `cygwin/cygwin-install-action@master` action
started to use newer MinGW headers.
The attached patch fixes compatibility with v13 MinGW headers while preserving
compatibility with v12.
Radek
The change to cygwin/socket.h concerns me, that is a public header, and
you can't assume they are including MinGW headers, and if they are how
they are configuring them (ie, _WIN32_WINNT define) or which ones they
are including. It looks like the mingw-w64 header #defines cmsghdr, maybe
Yeah.
That requires a different solution.
an #ifndef cmsghdr with a comment about this situation? Or how do other
Cygwin headers handle potential conflicts with Windows headers?
I think something like the attached to avoid seeing the conflicting
definitions? (unpleasant, but perhaps necessary)
From f24ddb5104f6496e06f8e9faf2a6c91e7329b22c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Radek=20Barto=C5=88?= <[email protected]>
Date: Mon, 9 Jun 2025 18:14:14 +0200
Subject: [PATCH] Cygwin: Fix compatibility with w32api v13 headers
---
winsup/cygwin/fhandler/socket_inet.cc | 5 +++++
winsup/cygwin/fhandler/socket_local.cc | 5 +++++
winsup/cygwin/local_includes/ntdll.h | 4 ++++
winsup/cygwin/net.cc | 5 +++++
4 files changed, 19 insertions(+)
diff --git a/winsup/cygwin/fhandler/socket_inet.cc
b/winsup/cygwin/fhandler/socket_inet.cc
index 22dfed63d..5ed0cb0ec 100644
--- a/winsup/cygwin/fhandler/socket_inet.cc
+++ b/winsup/cygwin/fhandler/socket_inet.cc
@@ -20,7 +20,12 @@
#undef u_long
#define u_long __ms_u_long
#include <w32api/ws2tcpip.h>
+/* 2025-06-09: win32api headers v13 now define a cmsghdr type which clashes
with
+ our socket.h. Arrange not to see it here. */
+#undef cmsghdr
+#define cmsghdr __ms_cmsghdr
#include <w32api/mswsock.h>
+#undef cmsghdr
#include <w32api/mstcpip.h>
#include <netinet/tcp.h>
#include <netinet/udp.h>
diff --git a/winsup/cygwin/fhandler/socket_local.cc
b/winsup/cygwin/fhandler/socket_local.cc
index ea5ee67cc..0498edc40 100644
--- a/winsup/cygwin/fhandler/socket_local.cc
+++ b/winsup/cygwin/fhandler/socket_local.cc
@@ -21,7 +21,12 @@
#define u_long __ms_u_long
#include "ntsecapi.h"
#include <w32api/ws2tcpip.h>
+/* 2025-06-09: win32api headers v13 now define a cmsghdr type which clashes
with
+ our socket.h. Arrange not to see it here. */
+#undef cmsghdr
+#define cmsghdr __ms_cmsghdr
#include <w32api/mswsock.h>
+#undef cmsghdr
#include <unistd.h>
#include <asm/byteorder.h>
#include <sys/socket.h>
diff --git a/winsup/cygwin/local_includes/ntdll.h
b/winsup/cygwin/local_includes/ntdll.h
index 97a83d1e3..fc2ab7a2e 100644
--- a/winsup/cygwin/local_includes/ntdll.h
+++ b/winsup/cygwin/local_includes/ntdll.h
@@ -490,6 +490,8 @@ typedef struct _FILE_DISPOSITION_INFORMATION_EX // 64
ULONG Flags;
} FILE_DISPOSITION_INFORMATION_EX, *PFILE_DISPOSITION_INFORMATION_EX;
+#if __MINGW64_VERSION_MAJOR < 13
+
typedef struct _FILE_STAT_INFORMATION // 68
{
LARGE_INTEGER FileId;
@@ -510,6 +512,8 @@ typedef struct _FILE_CASE_SENSITIVE_INFORMATION // 71
ULONG Flags;
} FILE_CASE_SENSITIVE_INFORMATION, *PFILE_CASE_SENSITIVE_INFORMATION;
+#endif
+
enum {
FILE_LINK_REPLACE_IF_EXISTS = 0x01,
FILE_LINK_POSIX_SEMANTICS = 0x02,
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 9d7224a21..579b1a70b 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -18,7 +18,12 @@ details. */
#undef u_long
#define u_long __ms_u_long
#include <w32api/ws2tcpip.h>
+/* 2025-06-09: win32api headers v13 now define a cmsghdr type which clashes
with
+ our socket.h. Arrange not to see it here. */
+#undef cmsghdr
+#define cmsghdr __ms_cmsghdr
#include <w32api/mswsock.h>
+#undef cmsghdr
#include <w32api/iphlpapi.h>
#define gethostname cygwin_gethostname
#include <unistd.h>
--
2.45.1