Skip to content

Conflict with DirectX-Headers #5079

@valeriydymura

Description

@valeriydymura

Conflict with DirectX-Headers

It's impossible to use DXC with DirectX-Headers on Linux.

Functional impact

I can't compile project on Linux.

Minimal repro steps

  1. Download DXC release(https://github.com/microsoft/DirectXShaderCompiler/releases/tag/v1.7.2212.1) and DirectX-Headers(https://github.com/microsoft/DirectX-Headers/releases/tag/v1.608.2)
  2. Create CMake project, add DirectX-Headers as subproject and link to DXC
  3. Create simple file:
#include <unknwn.h>
#include <directx/d3d12shader.h>
#include <dxc/dxcapi.h>

int main() {
    return 0;
}
  1. Try to compile with clang(version 15.0.7)

Expected result

It should be possible to use DXC with DirectX-Headers

Actual result

It doesn't compile.

Further technical details

Log:

In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:361:14: error: typedef redefinition with different types ('BYTE' (aka 'unsigned char') vs 'char')
typedef BYTE BOOLEAN;
             ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:38:14: note: previous definition is here
typedef char BOOLEAN;
             ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:364:14: error: typedef redefinition with different types ('bool' vs 'uint32_t' (aka 'unsigned int'))
typedef bool BOOL;
             ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:23:46: note: previous definition is here
typedef uint32_t UINT32, UINT, ULONG, DWORD, BOOL, WINBOOL;
                                             ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:368:14: error: typedef redefinition with different types ('long' vs 'int32_t' (aka 'int'))
typedef long LONG;
             ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:24:29: note: previous definition is here
typedef int32_t INT32, INT, LONG;
                            ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:370:23: error: typedef redefinition with different types ('unsigned long' vs 'uint32_t' (aka 'unsigned int'))
typedef unsigned long ULONG;
                      ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:23:32: note: previous definition is here
typedef uint32_t UINT32, UINT, ULONG, DWORD, BOOL, WINBOOL;
                               ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:371:19: error: typedef redefinition with different types ('long long' vs 'int64_t' (aka 'long'))
typedef long long LONGLONG;
                  ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:41:17: note: previous definition is here
typedef int64_t LONGLONG, *PLONGLONG;
                ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:372:19: error: typedef redefinition with different types ('long long' vs 'int64_t' (aka 'long'))
typedef long long LONG_PTR;
                  ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:42:17: note: previous definition is here
typedef int64_t LONG_PTR, *PLONG_PTR;
                ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:373:28: error: typedef redefinition with different types ('unsigned long long' vs 'uint64_t' (aka 'unsigned long'))
typedef unsigned long long ULONG_PTR;
                           ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:47:18: note: previous definition is here
typedef uint64_t ULONG_PTR, *PULONG_PTR;
                 ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:374:28: error: typedef redefinition with different types ('unsigned long long' vs 'uint64_t' (aka 'unsigned long'))
typedef unsigned long long ULONGLONG;
                           ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:39:18: note: previous definition is here
typedef uint64_t ULONGLONG;
                 ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:434:16: error: redefinition of '_GUID'
typedef struct _GUID
               ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:101:16: note: previous definition is here
typedef struct _GUID {
               ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:448:21: error: 'const' qualifier may not be applied to a reference
typedef const GUID &REFGUID;
                    ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:122:17: note: expanded from macro 'REFGUID'
#define REFGUID const GUID &
                ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:448:21: error: typedef redefinition with different types ('const GUID &' (aka 'const _GUID &') vs 'struct _GUID')
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:122:23: note: expanded from macro 'REFGUID'
#define REFGUID const GUID &
                      ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:106:3: note: previous definition is here
} GUID;
  ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:448:21: error: expected ';' after top level declarator
typedef const GUID &REFGUID;
                    ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:122:28: note: expanded from macro 'REFGUID'
#define REFGUID const GUID &
                           ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:449:21: error: 'const' qualifier may not be applied to a reference
typedef const GUID &REFCLSID;
                    ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:124:18: note: expanded from macro 'REFCLSID'
#define REFCLSID const IID &
                 ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:449:21: error: typedef redefinition with different types ('const GUID &' (aka 'const _GUID &') vs 'GUID' (aka '_GUID'))
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:124:24: note: expanded from macro 'REFCLSID'
#define REFCLSID const IID &
                       ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:118:14: note: previous definition is here
typedef GUID IID;
             ^
In file included from /home/keeper/test/main.cpp:2:
In file included from /mnt/project/ThirdParty/dxc/include/dxc/dxcapi.h:37:
/mnt/project/ThirdParty/dxc/include/dxc/WinAdapter.h:449:21: error: expected ';' after top level declarator
typedef const GUID &REFCLSID;
                    ^
/mnt/project/ThirdParty/d3d12/include/wsl/stubs/basetsd.h:124:28: note: expanded from macro 'REFCLSID'
#define REFCLSID const IID &
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
17 warnings and 20 errors generated.
ninja: build stopped: subcommand failed.

Metadata

Metadata

Assignees

Labels

buildIssues related to build and setup

Type

No type

Projects

Status

Triaged

Relationships

None yet

Development

No branches or pull requests

Issue actions