direct3d-headers: IID redefinition errors #766
Labels
No labels
CI
all
basisu
blog
bug
build
contributor-friendly
core
correctness
deferred
dev
direct3d-headers
docs
driver-os-issue
duplicate
dxcompiler
editor
examples
experiment
feature-idea
feedback
flac
freetype
gamemode
gkurve
glfw
gpu
gpu-dawn
harfbuzz
help welcome
in-progress
infrastructure
invalid
libmach
linux-audio-headers
long-term
mach
mach.gfx
mach.math
mach.physics
mach.testing
model3d
needs-triage
object
opengl-headers
opus
os/linux
os/macos
os/wasm
os/windows
package-manager
priority
proposal
proposal-accepted
question
roadmap
slipped
stability
sysaudio
sysgpu
sysjs
validating-fix
vulkan-zig-generated
wayland-headers
website
wontfix
wrench
www
x11-headers
xcode-frameworks
zig-update
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
hexops/mach#766
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I've been using Zig as a build tool for learning DirectX 12 and C.
I tried to use
system_sdk.zigto 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:
gitlab.com/denovodavid/rendering/-@5e332ebd0c/Commenting out
system_sdk.include(b, exe, .{});inbuild.zigshould build successfully.Here's the build log using
system_sdk:(there are more of the same errors if you increase the error limit)
Thanks for filing this. I just now had a chance to quickly look into it; and I agree it looks like the headers are wrong here.
If I had to guess, this issue was probably fixed upstream and we'll need to update our version of the headers in order to fix this. This is.. not exactly a trivial process: Microsoft has refused to open-source the IDL files used to generate these headers, so the open-source community (developers behind Wine, Valve/Proton, MinGW, etc.) are instead reproducing them by hand which is an arduous process - and is why Zig's DirectX headers are not totally up-to-date, too.
For Mach, in order to get updated DirectX headers in the meantime, we have the system-sdk headers as you noted: these come from a fork of Microsoft's proprietary IDL files which we modified to be somewhat translatable using WIDL (Wine's IDL -> .h compiler) so as to be compatible with clang/zig. We'll need to update that fork and recompile with WIDL in order to see if that fixes the issue.
I will get around to this, but it may be some time. A quicker workaround for your exact usecase would be to fork and directly patch the .h files.
https://github.com/hexops/mach/issues/1172