henrybetts / swift-webgpu

Swift bindings for WebGPU
MIT License
78 stars 3 forks source link

Can't build with latest Dawn #2

Closed stackotter closed 2 years ago

stackotter commented 2 years ago

Context

I downloaded and successfully built Dawn (commit 2aa0042b). And then attempted to build swift-webgpu (commit 18cb045) using the following command:

swift build -c release \
-Xcc -I../dawn/src/include \
-Xcc -I../dawn/out/Release/gen/src/include \
-Xlinker -L../dawn/out/Release \
-Xlinker -rpath -Xlinker ../dawn/out/Release

The build failed. I am on Xcode version 13.2 and macOS version 12.0.1

Log output

/Users/rohanvanklinken/Desktop/Projects/Swift/WebGPU/dawn/out/Release/gen/src/include/dawn/dawn_proc_table.h:8:16: error: 'DawnProcTable' has different definitions in different modules; definition in module 'CDawnProc' is here
typedef struct DawnProcTable {
               ^
/Users/rohanvanklinken/Desktop/Projects/Swift/WebGPU/dawn/out/Release/gen/src/include/dawn/dawn_proc_table.h:8:16: note: definition in module 'CDawnNative' is here
typedef struct DawnProcTable {
               ^
[1/8] Compiling DawnNative DawnNative.swift
henrybetts commented 2 years ago

Something strange is going on here, possibly even a clang bug. I am able to reproduce the same error occasionally by clearing the build folder and rebuilding, but not all of the time. I may need to dive deeper into clang modules at some point to understand what is happening.

For now though, c1f91b2 seems to fix this for me. Let me know otherwise.

stackotter commented 2 years ago

Thanks, that fixed it! I look forward to playing around with this a bit, it looks cool.