gst-plugins-bad fails to compile in Windows with OpenSSL 3.2.0
Describe your issue
Build gst-plugins-bad fails on Windows when using OpenSSL 3.2.0 headers. This doesn't happen with OpenSSl 3.1.4.
The error is the following:
[748/1041] Compiling C object ext/dtls/gstdtls.dll.p/gstdtlscertificate.c.obj
FAILED: ext/dtls/gstdtls.dll.p/gstdtlscertificate.c.obj
"cl" "-Iext\dtls\gstdtls.dll.p" "-Iext\dtls" "-I..\ext\dtls" "-I." "-I.." "-IC:/build/gtk/x64/debug/bin/../include/gstreamer-1.0" "-IC:/build/gtk/x64/debug/bin/../include" "-IC:/build/gtk/x64/debug/bin/../include/glib-2.0" "-IC:/build/gtk/x64/debug/bin/../lib/glib-2.0/include" "/MDd" "/nologo" "/showIncludes" "/utf-8" "/W2" "/Od" "/Zi" "/wd4018" "/wd4146" "/wd4244" "/wd4305" "/wd5051" "/utf-8" "-DG_DISABLE_CAST_CHECKS" "-DHAVE_CONFIG_H" "/Fdext\dtls\gstdtls.dll.p\gstdtlscertificate.c.pdb" /Foext/dtls/gstdtls.dll.p/gstdtlscertificate.c.obj "/c" ../ext/dtls/gstdtlscertificate.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(103): warning C4005: 'AF_IPX': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(457): note: see previous definition of 'AF_IPX'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(147): warning C4005: 'AF_MAX': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(476): note: see previous definition of 'AF_MAX'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(185): warning C4005: 'SO_DONTLINGER': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(399): note: see previous definition of 'SO_DONTLINGER'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(235): error C2011: 'sockaddr': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(482): note: see declaration of 'sockaddr'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(437): error C2059: syntax error: 'constant'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(572): warning C4005: 'IN_CLASSA': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(284): note: see previous definition of 'IN_CLASSA'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(578): warning C4005: 'IN_CLASSB': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(290): note: see previous definition of 'IN_CLASSB'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(584): warning C4005: 'IN_CLASSC': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(296): note: see previous definition of 'IN_CLASSC'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(595): warning C4005: 'INADDR_ANY': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(301): note: see previous definition of 'INADDR_ANY'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(597): warning C4005: 'INADDR_BROADCAST': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(303): note: see previous definition of 'INADDR_BROADCAST'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared\ws2def.h(633): error C2011: 'sockaddr_in': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(309): note: see declaration of 'sockaddr_in'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(136): error C2011: 'fd_set': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(65): note: see declaration of 'fd_set'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(156): warning C4005: 'FD_CLR': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(94): note: see previous definition of 'FD_CLR'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(171): warning C4005: 'FD_SET': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(99): note: see previous definition of 'FD_SET'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(180): error C2011: 'timeval': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(108): note: see declaration of 'timeval'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(236): error C2011: 'hostent': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(164): note: see declaration of 'hostent'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(249): error C2011: 'netent': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(177): note: see declaration of 'netent'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(256): error C2011: 'servent': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(184): note: see declaration of 'servent'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(268): error C2011: 'protoent': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(196): note: see declaration of 'protoent'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(364): error C2011: 'WSAData': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(319): note: see declaration of 'WSAData'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(462): error C2011: 'sockproto': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(491): note: see declaration of 'sockproto'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(504): error C2011: 'linger': 'struct' type redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(528): note: see declaration of 'linger'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(517): warning C4005: 'SOMAXCONN': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(541): note: see previous definition of 'SOMAXCONN'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(552): warning C4005: 'FD_READ': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(559): note: see previous definition of 'FD_READ'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(555): warning C4005: 'FD_WRITE': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(560): note: see previous definition of 'FD_WRITE'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(558): warning C4005: 'FD_OOB': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(561): note: see previous definition of 'FD_OOB'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(561): warning C4005: 'FD_ACCEPT': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(562): note: see previous definition of 'FD_ACCEPT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(564): warning C4005: 'FD_CONNECT': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(563): note: see previous definition of 'FD_CONNECT'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(567): warning C4005: 'FD_CLOSE': macro redefinition
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock.h(564): note: see previous definition of 'FD_CLOSE'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um\winsock2.h(1625): error C2375: 'accept': redefinition; different linkage
This might be caused by windows.h
being included before winsock2.h
. Please see https://stackoverflow.com/a/1372836.
Expected Behavior
Build finishes successfully
Observed Behavior
Build fails
How reproducible is the bug?
Always
Solutions you have tried
Removing the following code
#ifdef G_OS_WIN32
#include <windows.h>
#ifdef X509_NAME
#undef X509_NAME
#endif
#endif
solves the build issue with OpenSSL 3.2.0. However that code was included as a name collision fix with OpenSSL. See 0d3ca639. Suggestions are welcome.