Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure with D3D12 code with mingw-w64 headers earlier than from 2024-06-16 #96060

Closed
alvinhochun opened this issue Aug 25, 2024 · 3 comments · Fixed by #96085
Closed

Comments

@alvinhochun
Copy link
Contributor

Tested versions

System information

Windows 10

Issue description

When building with not-bleeding-edge mingw-w64 headers, presumably any versions earlier than mingw-w64/mingw-w64@41d29b8 (in my case, the headers from llvm-mingw-20240606), I get the following error:

In file included from servers\display_server.cpp:42:
In file included from ./drivers/d3d12/rendering_context_driver_d3d12.h:38:
In file included from ./drivers/d3d12/rendering_device_driver_d3d12.h:55:
In file included from thirdparty\directx_headers\include\directx/d3dx12.h:11:
In file included from thirdparty\directx_headers\include\directx/d3d12.h:26:
In file included from D:/dev/toolchain/llvm-mingw/llvm-mingw-20240606-ucrt-x86_64/include/rpc.h:16:
In file included from D:/dev/toolchain/llvm-mingw/llvm-mingw-20240606-ucrt-x86_64/include/windows.h:97:
In file included from D:/dev/toolchain/llvm-mingw/llvm-mingw-20240606-ucrt-x86_64/include/winscard.h:10:
In file included from D:/dev/toolchain/llvm-mingw/llvm-mingw-20240606-ucrt-x86_64/include/wtypes.h:8:
D:/dev/toolchain/llvm-mingw/llvm-mingw-20240606-ucrt-x86_64/include/rpcndr.h:15:2: error: incorrect <rpcndr.h> version. Use the header that matches with the MIDL compiler.
   15 | #error incorrect <rpcndr.h> version. Use the header that matches with the MIDL compiler.
      |  ^
1 error generated.

I suspect it to be caused by this change: https://github.com/godotengine/godot/pull/91172/files#diff-bed1d5fa123300327771a6b6219ef4fed87354d7aa92dfdd9e72cde434de524fR42

CC @clayjohn

Steps to reproduce

Build using a mingw-w64 toolchain that is not using bleeding-edge mingw-w64 headers, with d3d12 enabled.

Minimal reproduction project (MRP)

n/a

@bruvzg
Copy link
Member

bruvzg commented Aug 25, 2024

Fixable by setting RPCNDR version for the platform code (currently done only for d3d12 module). Not sure if this is caused by MinGW headers, DX headers or DisplayServer change, maybe some header is included where it should not be.

-env.AppendUnique(CPPDEFINES=["D3D12_ENABLED", "RD_ENABLED"])
+env.AppendUnique(CPPDEFINES=["D3D12_ENABLED", "RD_ENABLED", ("__REQUIRED_RPCNDR_H_VERSION__", 475)])

@alvinhochun
Copy link
Contributor Author

alvinhochun commented Aug 25, 2024

It seems __REQUIRED_RPCNDR_H_VERSION__ does get defined by drivers\d3d12\SCsub, but #91172 added the include in display_server.cpp which is outside of drivers\d3d12.

I believe it should be possible to refactor the code so that display_server.cpp doesn't need to include RD headers, but I guess defining __REQUIRED_RPCNDR_H_VERSION__ at a wider scope can fix the issue. (Though I hate that it would force a lot of objects to be recompiled.)

@bruvzg
Copy link
Member

bruvzg commented Aug 25, 2024

Though I hate that it would force a lot of objects to be recompiled.

It can be defined directly in the rendering_device_driver_d3d12.h header (before any includes and in if !defined(_MSC_VER) block) and should cover both driver and display server, but not the rest of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Immediate Blocker
Development

Successfully merging a pull request may close this issue.

3 participants