libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
9.85k stars 1.78k forks source link

MSYS2-based Windows build is currently broken #10230

Open c0d3h4x0r opened 4 years ago

c0d3h4x0r commented 4 years ago

Version/Commit

master @ a8a2294f276c7912dc399bd7d4d8611e14b26a17

Environment information

Error output:

In file included from gfx/common/d3d10_common.c:20:
gfx/common/d3d10_common.h:1121:7: error: expected declaration specifiers or ‘...’ before ‘!’ token
 1121 |       !(sizeof(d3d10_uniform_t) & 0xF), "sizeof(d3d10_uniform_t) must be a multiple of 16");
      |       ^
gfx/common/d3d10_common.h:1121:41: error: expected declaration specifiers or ‘...’ before string constant
 1121 |       !(sizeof(d3d10_uniform_t) & 0xF), "sizeof(d3d10_uniform_t) must be a multiple of 16");
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gfx/drivers_font/d3d10_font.c:25:
/src/RetroArch/gfx/common/d3d10_common.h:1121:7: error: expected declaration specifiers or ‘...’ before ‘!’ token
 1121 |       !(sizeof(d3d10_uniform_t) & 0xF), "sizeof(d3d10_uniform_t) must be a multiple of 16");
      |       ^
/src/RetroArch/gfx/common/d3d10_common.h:1121:41: error: expected declaration specifiers or ‘...’ before string constant
 1121 |       !(sizeof(d3d10_uniform_t) & 0xF), "sizeof(d3d10_uniform_t) must be a multiple of 16");
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:206: obj-unix/debug/gfx/common/d3d10_common.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:206: obj-unix/debug/gfx/drivers_font/d3d10_font.o] Error 1
In file included from gfx/drivers/d3d10.c:39:
gfx/drivers/../common/d3d10_common.h:1121:7: error: expected declaration specifiers or ‘...’ before ‘!’ token
 1121 |       !(sizeof(d3d10_uniform_t) & 0xF), "sizeof(d3d10_uniform_t) must be a multiple of 16");
      |       ^
gfx/drivers/../common/d3d10_common.h:1121:41: error: expected declaration specifiers or ‘...’ before string constant
 1121 |       !(sizeof(d3d10_uniform_t) & 0xF), "sizeof(d3d10_uniform_t) must be a multiple of 16");
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gfx/drivers_display/gfx_display_d3d10.c:29:
/src/RetroArch/gfx/common/d3d10_common.h:1121:7: error: expected declaration specifiers or ‘...’ before ‘!’ token
 1121 |       !(sizeof(d3d10_uniform_t) & 0xF), "sizeof(d3d10_uniform_t) must be a multiple of 16");
      |       ^
/src/RetroArch/gfx/common/d3d10_common.h:1121:41: error: expected declaration specifiers or ‘...’ before string constant
 1121 |       !(sizeof(d3d10_uniform_t) & 0xF), "sizeof(d3d10_uniform_t) must be a multiple of 16");
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:206: obj-unix/debug/gfx/drivers_display/gfx_display_d3d10.o] Error 1
make: *** [Makefile:206: obj-unix/debug/gfx/drivers/d3d10.o] Error 1
In file included from gfx/drivers/../common/d3d11_common.h:24,
                 from gfx/drivers/d3d11.c:52:
gfx/include/dxsdk/d3d11.h:12275:13: error: unknown type name ‘_Inout_opt_bytecount_’
12275 |             _Inout_opt_bytecount_(IVSize)  void *pIV);
      |             ^~~~~~~~~~~~~~~~~~~~~
gfx/include/dxsdk/d3d11.h:12294:13: error: unknown type name ‘_Inout_opt_bytecount_’
12294 |             _Inout_opt_bytecount_(IVSize)  void *pIV);
      |             ^~~~~~~~~~~~~~~~~~~~~
In file included from gfx/common/d3d11_common.h:24,
                 from gfx/common/d3d11_common.c:20:
gfx/include/dxsdk/d3d11.h:12275:13: error: unknown type name ‘_Inout_opt_bytecount_’
12275 |             _Inout_opt_bytecount_(IVSize)  void *pIV);
      |             ^~~~~~~~~~~~~~~~~~~~~
gfx/include/dxsdk/d3d11.h:12294:13: error: unknown type name ‘_Inout_opt_bytecount_’
12294 |             _Inout_opt_bytecount_(IVSize)  void *pIV);
      |             ^~~~~~~~~~~~~~~~~~~~~
In file included from /src/RetroArch/gfx/common/d3d11_common.h:24,
                 from gfx/drivers_font/d3d11_font.c:24:
gfx/include/dxsdk/d3d11.h:12275:13: error: unknown type name ‘_Inout_opt_bytecount_’
12275 |             _Inout_opt_bytecount_(IVSize)  void *pIV);
      |             ^~~~~~~~~~~~~~~~~~~~~
gfx/include/dxsdk/d3d11.h:12294:13: error: unknown type name ‘_Inout_opt_bytecount_’
12294 |             _Inout_opt_bytecount_(IVSize)  void *pIV);
      |             ^~~~~~~~~~~~~~~~~~~~~
In file included from gfx/drivers/d3d11.c:52:
gfx/drivers/../common/d3d11_common.h: In function ‘D3D11EncryptionBlt’:
gfx/drivers/../common/d3d11_common.h:1646:27: error: ‘struct ID3D11VideoContextVtbl’ has no member named ‘EncryptionBlt’; did you mean ‘GetEncryptionBltKey’?
 1646 |    video_context->lpVtbl->EncryptionBlt(
      |                           ^~~~~~~~~~~~~
      |                           GetEncryptionBltKey
gfx/drivers/../common/d3d11_common.h: In function ‘D3D11DecryptionBlt’:
gfx/drivers/../common/d3d11_common.h:1660:27: error: ‘struct ID3D11VideoContextVtbl’ has no member named ‘DecryptionBlt’; did you mean ‘GetEncryptionBltKey’?
 1660 |    video_context->lpVtbl->DecryptionBlt(
      |                           ^~~~~~~~~~~~~
      |                           GetEncryptionBltKey
In file included from gfx/drivers/d3d11.c:52:
gfx/drivers/../common/d3d11_common.h: At top level:
gfx/drivers/../common/d3d11_common.h:2488:7: error: expected declaration specifiers or ‘...’ before ‘(’ token
 2488 |       (!(sizeof(d3d11_uniform_t) & 0xF)), "sizeof(d3d11_uniform_t) must be a multiple of 16");
      |       ^
gfx/drivers/../common/d3d11_common.h:2488:43: error: expected declaration specifiers or ‘...’ before string constant
 2488 |       (!(sizeof(d3d11_uniform_t) & 0xF)), "sizeof(d3d11_uniform_t) must be a multiple of 16");
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gfx/common/d3d11_common.c:20:
gfx/common/d3d11_common.h: In function ‘D3D11EncryptionBlt’:
gfx/common/d3d11_common.h:1646:27: error: ‘struct ID3D11VideoContextVtbl’ has no member named ‘EncryptionBlt’; did you mean ‘GetEncryptionBltKey’?
 1646 |    video_context->lpVtbl->EncryptionBlt(
      |                           ^~~~~~~~~~~~~
      |                           GetEncryptionBltKey
gfx/common/d3d11_common.h: In function ‘D3D11DecryptionBlt’:
gfx/common/d3d11_common.h:1660:27: error: ‘struct ID3D11VideoContextVtbl’ has no member named ‘DecryptionBlt’; did you mean ‘GetEncryptionBltKey’?
 1660 |    video_context->lpVtbl->DecryptionBlt(
      |                           ^~~~~~~~~~~~~
      |                           GetEncryptionBltKey
make: *** [Makefile:206: obj-unix/debug/gfx/drivers/d3d11.o] Error 1
In file included from gfx/common/d3d11_common.c:20:
gfx/common/d3d11_common.h: At top level:
In file included from /src/RetroArch/gfx/common/d3d11_common.h:24,
                 from gfx/drivers_display/gfx_display_d3d11.c:28:
gfx/include/dxsdk/d3d11.h:12275:13: error: unknown type name ‘_Inout_opt_bytecount_’
12275 |             _Inout_opt_bytecount_(IVSize)  void *pIV);
      |             ^~~~~~~~~~~~~~~~~~~~~
gfx/common/d3d11_common.h:2488:7: error: expected declaration specifiers or ‘...’ before ‘(’ token
 2488 |       (!(sizeof(d3d11_uniform_t) & 0xF)), "sizeof(d3d11_uniform_t) must be a multiple of 16");
      |       ^
gfx/common/d3d11_common.h:2488:43: error: expected declaration specifiers or ‘...’ before string constant
 2488 |       (!(sizeof(d3d11_uniform_t) & 0xF)), "sizeof(d3d11_uniform_t) must be a multiple of 16");
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from gfx/drivers_font/d3d11_font.c:24:
/src/RetroArch/gfx/common/d3d11_common.h: In function ‘D3D11EncryptionBlt’:
/src/RetroArch/gfx/common/d3d11_common.h:1646:27: error: ‘struct ID3D11VideoContextVtbl’ has no member named ‘EncryptionBlt’; did you mean ‘GetEncryptionBltKey’?
 1646 |    video_context->lpVtbl->EncryptionBlt(
      |                           ^~~~~~~~~~~~~
      |                           GetEncryptionBltKey
/src/RetroArch/gfx/common/d3d11_common.h: In function ‘D3D11DecryptionBlt’:
/src/RetroArch/gfx/common/d3d11_common.h:1660:27: error: ‘struct ID3D11VideoContextVtbl’ has no member named ‘DecryptionBlt’; did you mean ‘GetEncryptionBltKey’?
 1660 |    video_context->lpVtbl->DecryptionBlt(
      |                           ^~~~~~~~~~~~~
      |                           GetEncryptionBltKey
make: *** [Makefile:206: obj-unix/debug/gfx/common/d3d11_common.o] Error 1
gfx/include/dxsdk/d3d11.h:12294:13: error: unknown type name ‘_Inout_opt_bytecount_’
12294 |             _Inout_opt_bytecount_(IVSize)  void *pIV);
      |             ^~~~~~~~~~~~~~~~~~~~~
In file included from gfx/drivers_font/d3d11_font.c:24:
/src/RetroArch/gfx/common/d3d11_common.h: At top level:
/src/RetroArch/gfx/common/d3d11_common.h:2488:7: error: expected declaration specifiers or ‘...’ before ‘(’ token
 2488 |       (!(sizeof(d3d11_uniform_t) & 0xF)), "sizeof(d3d11_uniform_t) must be a multiple of 16");
      |       ^
/src/RetroArch/gfx/common/d3d11_common.h:2488:43: error: expected declaration specifiers or ‘...’ before string constant
 2488 |       (!(sizeof(d3d11_uniform_t) & 0xF)), "sizeof(d3d11_uniform_t) must be a multiple of 16");
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:206: obj-unix/debug/gfx/drivers_font/d3d11_font.o] Error 1
In file included from gfx/drivers_display/gfx_display_d3d11.c:28:
/src/RetroArch/gfx/common/d3d11_common.h: In function ‘D3D11EncryptionBlt’:
/src/RetroArch/gfx/common/d3d11_common.h:1646:27: error: ‘struct ID3D11VideoContextVtbl’ has no member named ‘EncryptionBlt’; did you mean ‘GetEncryptionBltKey’?
 1646 |    video_context->lpVtbl->EncryptionBlt(
      |                           ^~~~~~~~~~~~~
      |                           GetEncryptionBltKey
/src/RetroArch/gfx/common/d3d11_common.h: In function ‘D3D11DecryptionBlt’:
/src/RetroArch/gfx/common/d3d11_common.h:1660:27: error: ‘struct ID3D11VideoContextVtbl’ has no member named ‘DecryptionBlt’; did you mean ‘GetEncryptionBltKey’?
 1660 |    video_context->lpVtbl->DecryptionBlt(
      |                           ^~~~~~~~~~~~~
      |                           GetEncryptionBltKey
In file included from gfx/drivers_display/gfx_display_d3d11.c:28:
/src/RetroArch/gfx/common/d3d11_common.h: At top level:
/src/RetroArch/gfx/common/d3d11_common.h:2488:7: error: expected declaration specifiers or ‘...’ before ‘(’ token
 2488 |       (!(sizeof(d3d11_uniform_t) & 0xF)), "sizeof(d3d11_uniform_t) must be a multiple of 16");
      |       ^
/src/RetroArch/gfx/common/d3d11_common.h:2488:43: error: expected declaration specifiers or ‘...’ before string constant
 2488 |       (!(sizeof(d3d11_uniform_t) & 0xF)), "sizeof(d3d11_uniform_t) must be a multiple of 16");
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:206: obj-unix/debug/gfx/drivers_display/gfx_display_d3d11.o] Error 1
inactive123 commented 4 years ago

I don't get this error on my end.

c0d3h4x0r commented 4 years ago

Which version of gcc are you using?

c0d3h4x0r commented 4 years ago

Also, when did you last build from clean?

inactive123 commented 4 years ago

I've asked @Alcaro and I think we came to the consensus that we might as well drop the static assert.

https://github.com/libretro/RetroArch/commit/212f32e2fd9410fc4a5a52e46bd75f4bb75f36da

Try to see if this compiles for you now.

c0d3h4x0r commented 4 years ago

Yeah, just noticed you removed them. Trying another build...

c0d3h4x0r commented 4 years ago

That fixed the static asserts, but I still get all the other errors listed herein.

c0d3h4x0r commented 4 years ago

Looks to me like they are all caused by the inability of the compiler to recognize the _Inout_opt_bytecount_ SAL annotation.

inactive123 commented 4 years ago

Can you show the current compilation error log?

c0d3h4x0r commented 4 years ago

And I suspect that's due to d3d11.h neglecting to #include "sal.h" (or something similar?).

c0d3h4x0r commented 4 years ago

Actually, it looks like d3d11.h expects rpcsal.h to have been included, and asserts that it is the correct version... but rpcsal.h does not define _Inout_opt_bytecount_.

inactive123 commented 4 years ago

Can you try getting it building on your end and then sending a PR? I can unfortunately not reproduce your issue here on Msys2 and GCC 9.2.0. It might well be that we need some header includes that are missing right now which for whatever reason are not an issue on my system locally.

c0d3h4x0r commented 4 years ago

Yep, already working on it. I assume that modifying d3d11.h itself is not advised, given that it looks to be supplied by the DirectX SDK and this codebase presumably doesn't want to fork it.

c0d3h4x0r commented 4 years ago

Do you have sal.h somewhere in your source tree or include path? Because I don't see it anywhere in the repo, and it is what would normally define _Inout_opt_bytecount_.

c0d3h4x0r commented 4 years ago

Found this header in another project someplace; seems relevant?

https://github.com/bkaradzic/bx/blob/master/include/compat/mingw/salieri.h

c0d3h4x0r commented 4 years ago

Looks like it originates from here: https://github.com/nemequ/salieri

Alcaro commented 4 years ago

sal.h should be shipped with your compiler, but if yours doesn't implement or define away _Inout_optbytecount (mine, gcc 8.1.0 via mingw-w64, does not), then I agree salieri seems like a good solution.

I have no clue why any of this ever worked for anyone. static_assert is a C11/C++11 thing, we're not using that.

c0d3h4x0r commented 4 years ago

Actually, it looks like dxgi_common.h is just missing a define for this.

c0d3h4x0r commented 4 years ago

Also noticed this in dxgi_common.h, which may apply to your conundrum re: static_assert:

#ifndef __cplusplus
#define static_assert _Static_assert
#endif
c0d3h4x0r commented 4 years ago

This is all wrapped inside an #ifdef __MINGW32__ check. Is the 64-bit MSYS2-based Windows build supposed to be a MINGW32 build?

c0d3h4x0r commented 4 years ago

I've been building using the command make DEBUG=1 GL_DEBUG=1 -j8. Should I have instead been running retroarch-mingw-build.sh? If so, the documentation for building RetroArch (at https://docs.libretro.com/development/retroarch/compilation/windows/ ) did not steer me toward running that script.

c0d3h4x0r commented 4 years ago

Regardless, supposedly the mingw compiler itself is supposed to define __MINGW32__, but that is clearly not defined as expected.

c0d3h4x0r commented 4 years ago

So apparently the correct command to build debug bits using the correct version of the compiler toolchain should actually be something more like this:

C_COMPILER=/mingw64/bin/x86_64-w64-mingw32-gcc CXX_COMPILER=/mingw64/bin/x86_64-w64-mingw32-g++ WINDRES=/mingw64/bin/x86_64-w64-mingw32-windres /mingw64/bin/mingw32-make DEBUG=1 GL_DEBUG=1 -j8

That actually uses gcc 9.2.0 rather than 9.1.0 (which is what's located at /usr/bin/gcc in my MSYS2 shell).

But that still doesn't cause __MINGW32__ to get defined like I'd expect. Still trying to figure out why.

c0d3h4x0r commented 4 years ago

I finally figured out what's been causing all my problems.

This one line of the documentation is too vague:

Start the MINGW64 or the MINGW32 shell depending on what you want to compile

I had been launching my shell via win32env.cmd or msys2_shell.cmd -- but apparently neither of those are the right way to get a MINGW shell. Apparently I needed to run mingw64.exe to launch the right shell. After doing that and rerunning ./configure and make clean, my build finally appears to be working.

The documentation really needs to be updated to call out that subtle but very important distinction. As a sanity check, the developer should run uname -s to validate that it says their shell is MINGW-based.

BenMcLean commented 3 years ago

I ran into this same issue. All I needed to do to get past this was close the 32-bit MSYS2 shell and open the 64-bit MSYS2 shell. It is not helpful that the MSYS2 window doesn't say which shell it is in the title bar. The icons have slightly different colors but that doesn't help if you haven't memorized them and you're totally out of luck if you're colorblind.

This documentation should probably also take the Cg dependency out. nvidia have discontinued Cg