On 09/06/2025 23:20, Brian Inglis wrote:
On 2025-06-09 15:56, Jeremy Drake via Cygwin-patches wrote:
On Mon, 9 Jun 2025, Brian Inglis wrote:

On 2025-06-09 12:54, Jeremy Drake via Cygwin-patches wrote:
On Mon, 9 Jun 2025, Radek Barton via Cygwin-patches wrote:
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.

Perhaps in the case of this build, but not necessarily anywhere else in Cygwin
using BSD sockets.

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 an #ifndef cmsghdr with a comment about this situation?  Or how do other
Cygwin headers handle potential conflicts with Windows headers?
I appear to be missing where Mingw headers other than ntstatus.h are included
in these Cygwin headers so how would Mingw version be defined here?

Inside Cygwin, additional Windows headers are included, including winsock
headers to implement sockets within Cygwin.

I understand that happens during the DLL build, but I am still not seeing where any of those nested header includes, whether __INSIDE_CYGWIN__ or not, includes any Mingw headers to define that version.
So I do not believe any such fix should be applied here.

Try adding e.g. '#define __MINGW64_VERSION_MAJOR 99' before the comparison, and compiling. The results might be enlightening:

  CXX      x86_64/fastcwd.o
In file included from 
/work/cygwin/src/winsup/cygwin/local_includes/cygtls.h:300,
                 from ./globals.h:5,
                 from 
/work/cygwin/src/winsup/cygwin/local_includes/winsup.h:281,
                 from ../../../../src/winsup/cygwin/x86_64/fastcwd.cc:9:
/work/cygwin/src/winsup/cygwin/local_includes/ntdll.h:493:9: error: 
‘__MINGW64_VERSION_MAJOR’ redefined [-Werror]
  493 | #define __MINGW64_VERSION_MAJOR 99
      |         ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/w32api/_mingw.h:10,
                 from /usr/include/w32api/windows.h:9,
                 from 
/work/cygwin/src/winsup/cygwin/local_includes/winlean.h:58,
                 from /work/cygwin/src/winsup/cygwin/local_includes/winsup.h:82:
/usr/include/w32api/_mingw_mac.h:17:9: note: this is the location of the 
previous definition
   17 | #define __MINGW64_VERSION_MAJOR 13
      |         ^~~~~~~~~~~~~~~~~~~~~~~

(and certainly quicker than grepping through a maze of include files :))

Reply via email to