Reference https://bugs.winehq.org/show_bug.cgi?id=54985
From the line we see the mingw version used causes an In file included from /usr/share/mingw-w64/include/unknwnbase.h:47, [ 935s] from /usr/share/mingw-w64/include/objidlbase.h:439, [ 935s] from include/combaseapi.h:29, [ 935s] from include/objbase.h:267, [ 935s] from include/ole2.h:25, [ 935s] from /usr/share/mingw-w64/include/wtypes.h:13, [ 935s] from include/winscard.h:22, [ 935s] from include/windows.h:68, [ 935s] from libs/vkd3d/include/private/vkd3d_common.h:23, [ 935s] from libs/vkd3d/libs/vkd3d-shader/vkd3d_shader_private.h:49, [ 935s] from libs/vkd3d/libs/vkd3d-shader/preproc.y:24, [ 935s] from libs/vkd3d/libs/vkd3d-shader/preproc.l:23: [ 935s] /usr/share/mingw-w64/include/wtypesbase.h:148:16: error: redefinition of 'struct _SECURITY_ATTRIBUTES' [ 935s] 148 | typedef struct _SECURITY_ATTRIBUTES {
The included file winscard.h seemed a little odd. The vkd3d isn't going to use this. Adding the define WIN32_LEAN_AND_MEAN to the Makefile.in (in wine), produce the following warnings.
/home/alesliehughes/wine/libs/vkd3d/include/private/vkd3d_common.h:75:5: warning: implicit declaration of function ‘abort’ [-Wimplicit-function-declaration] 75 | abort(); | ^~~~~ /home/alesliehughes/wine/libs/vkd3d/include/private/vkd3d_common.h:258:14: warning: implicit declaration of function ‘atoi’ [-Wimplicit-function-declaration] 258 | *major = atoi(version);
Adding header <stdlib.h> removed all the warnings.
-- v2: include: Avoid including unnecessary Windows headers.
From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
We only require a few types and declarations. --- include/private/vkd3d_common.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h index 4f9dc4d62..6be3cee8f 100644 --- a/include/private/vkd3d_common.h +++ b/include/private/vkd3d_common.h @@ -20,6 +20,7 @@ #define __VKD3D_COMMON_H
#include "config.h" +#define WIN32_LEAN_AND_MEAN #include "vkd3d_windows.h" #include "vkd3d_types.h"
@@ -28,6 +29,7 @@ #include <stdbool.h> #include <stdint.h> #include <stdio.h> +#include <stdlib.h>
#ifdef _MSC_VER #include <intrin.h>
Works for me. We're close enough to the vkd3d 1.8 release date (tomorrow if we can get it out in time...) that I'm going to defer committing it until after the release though.
Unfortunately, it looks like this breaks "make crosstest" for me. I haven't looked much into the actual cause yet.
I've run make crosstest and I only get multiple warnings of /usr/share/mingw-w64/include/psdk_inc/intrin-impl.h:838:1: warning: array subscript 0 is outside array bounds of ‘long long unsigned int[0]’ [-Warray-bounds] 838 | __buildreadseg(__readgsqword, unsigned __int64, "gs", "q")
It looks like the issue I was seeing is caused by older MinGW having broken WIDL_C_INLINE_WRAPPERS for AsyncIMultiQIVtbl. In particular, before the patch in this MR, objidlbase.h would be pulled in by vkd3d_windows.h from tests/d3d12_crosstests.h, before we define WIDL_C_INLINE_WRAPPERS. After this patch objidlbase.h is instead pulled in by vkd3d_d3d12.h, after we define WIDL_C_INLINE_WRAPPERS.
The (newer) version of MinGW in Debian stable doesn't have this issue, which probably means we don't care, and I've added a local workaround instead.
This merge request was approved by Henri Verbeet.