Page MenuHome GnuPG

Fix MinGW compilation error with 'struct _stat32' in common/sysutils.c from gnupg-2.3.4
Open, NormalPublic


The use of struct _stat32 in sysutils.c from gnupg-2.3.4 causes compilation errors when using's MinGW.
The attached patch fixes that.

Event Timeline

werner triaged this task as Normal priority.Mar 22 2022, 11:49 AM
werner edited projects, added patch, Feature Request, toolchain, gnupg (gpg23); removed Bug Report.
werner added a subscriber: werner.

Turned into a feature request because native building on Windows is not supported.

I guess I don't understand what you mean by "native building". This build was with MinGW, which is as "native" as MinGW64 is.
The reason for the problem is (AFAIU) that MinGW64 went after Microsoft's change in stat due to the 32-bit vs 64-bit time and off_t values issue.s That change breaks backward compatibility in more than one way: programs compiled on some versions of Windows will not run on other versions.'s MinGW kept the original semantics and symbols, which is why _stat32 exists in the's headers, but is not exposed by default.

I hope a single #ifdef for a single line is not a significant price to pay for the solution, especially since this is already in a w32-specific code part, and that you will agree to accept that patch.