-
-
Notifications
You must be signed in to change notification settings - Fork 199
Description
I've been using Zig as a build tool for learning DirectX 12 and C.
I tried to use system_sdk.zig to get the latest d3d12 headers, but I'm encountering some errors.
Specifically, errors like ...include/d3d12sdklayers.h:3442:13: error: redefinition of 'IID_ID3D12Debug1'.
Looking in the headers there are multiple DEFINE_GUID(IID_ID3D12Debug1, ... statements, which seem to be causing the errors.
I don't know if there's some compiler flag that can ignore these errors, or if the headers need fixing.
If time permits, any help here would be very much appreciated 🙏
Here's my repo of a spinning triangle: https://gitlab.com/denovodavid/rendering/-/tree/5e332ebd0c2c1e634757e067fb7982d953bef990/
Commenting out system_sdk.include(b, exe, .{}); in build.zig should build successfully.
Here's the build log using system_sdk:
(there are more of the same errors if you increase the error limit)
❯ zig build run
zig build-exe renderer Debug native: error: error(compilation): clang failed with stderr: In file included from C:\Users\david.holland\Dev\rendering\src\main.c:19:
In file included from C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12.h:475:
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3dcommon.h:350:13: error: redefinition of 'IID_ID3D10Blob'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3dcommon.h:343:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3dcommon.h:537:19: warning: redefinition of typedef 'ID3DInclude' is a C11 feature [-Wtypedef-redefinition]
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3dcommon.h:534:31: note: previous definition is here
In file included from C:\Users\david.holland\Dev\rendering\src\main.c:19:
In file included from C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12.h:20361:
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3441:13: error: redefinition of 'IID_ID3D12Debug'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:167:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3442:13: error: redefinition of 'IID_ID3D12Debug1'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:248:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3443:13: error: redefinition of 'IID_ID3D12Debug2'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:346:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3444:13: error: redefinition of 'IID_ID3D12Debug3'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:423:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3445:13: error: redefinition of 'IID_ID3D12Debug4'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:532:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3446:13: error: redefinition of 'IID_ID3D12Debug5'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:645:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3447:13: error: redefinition of 'IID_ID3D12DebugDevice1'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:813:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3448:13: error: redefinition of 'IID_ID3D12DebugDevice'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:920:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3449:13: error: redefinition of 'IID_ID3D12DebugDevice2'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:1018:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3450:13: error: redefinition of 'IID_ID3D12DebugCommandQueue'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:1141:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3451:13: error: redefinition of 'IID_ID3D12DebugCommandList1'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:1228:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3452:13: error: redefinition of 'IID_ID3D12DebugCommandList'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:1339:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3453:13: error: redefinition of 'IID_ID3D12DebugCommandList2'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:1441:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3454:13: error: redefinition of 'IID_ID3D12SharingContract'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:1565:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3455:13: error: redefinition of 'IID_ID3D12InfoQueue'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:2615:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3456:13: error: redefinition of 'IID_ID3D12InfoQueue1'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12sdklayers.h:3076:13: note: previous definition is here
In file included from C:\Users\david.holland\Dev\rendering\src\main.c:19:
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12.h:22297:13: error: redefinition of 'IID_ID3D12Object'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12.h:3194:13: note: previous definition is here
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12.h:22298:13: error: redefinition of 'IID_ID3D12DeviceChild'
C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include/d3d12.h:3314:13: note: previous definition is here
fatal error: too many errors emitted, stopping now [-ferror-limit=]
zig build-exe renderer Debug native: error: the following command failed with 1 compilation errors:
C:\Users\david.holland\scoop\apps\zig-dev\current\zig.exe build-exe -cflags -std=c99 -DCOBJMACROS -O0 -gdwarf -- C:\Users\david.holland\Dev\rendering\src\main.c -ldxgi -ld3d12 -ld3dcompiler_47 -lc --cache-dir C:\Users\david.holland\Dev\rendering\zig-cache --global-cache-dir C:\Users\david.holland\AppData\Local\zig --name renderer -I C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\include -L C:\Users\david.holland\AppData\Local\mach\sdk-windows-x86_64\lib --listen=-
Build Summary: 1/6 steps succeeded; 1 failed (disable with -fno-summary)
run transitive failure
+- run renderer transitive failure
+- zig build-exe renderer Debug native 1 errors
+- install transitive failure
+- install renderer transitive failure
| +- zig build-exe renderer Debug native (reused)
+- install src\shader.hlsl to bin/shader.hlsl cached
C:\Users\david.holland\Dev\rendering\src\main.c:1:1: error: unable to build C object: clang exited with code 1