eliemichel / WebGPU-distribution

Distributions of WebGPU for native and web development, easy to integrate and interchangeable.
MIT License
159 stars 29 forks source link

Failed to build with dawn, works with wgpu #17

Closed imadr closed 4 months ago

imadr commented 6 months ago

Here is the full cmake log, maybe related to #15 ? Using the main branch and setting WEBGPU_BACKEND=DAWN

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
Using Win32 for window creation
Using Dawn backend for WebGPU
No build type selected, default to Debug
Dawn build D3D11 backend: OFF
Dawn build D3D12 backend: OFF
Dawn build Metal backend: OFF
Dawn build Vulkan backend: ON
Dawn build OpenGL backend: OFF
Dawn build OpenGL ES backend: OFF
Dawn build Null backend: OFF
Dawn build with asserts in all configurations: OFF
Dawn build Wayland support: OFF
Dawn build X11 support: OFF
Dawn build Windows UI support: ON
Dawn build samples: OFF
Dawn build Node bindings: OFF
Dawn build Swiftshader: OFF
Dawn build benchmarks: OFF
Dawn build PIC: OFF
Dawn build with ASAN: OFF
Dawn build with TSAN: OFF
Dawn build with MSAN: OFF
Dawn build with UBSAN: OFF
Tint build samples: OFF
Tint build docs: OFF
Tint build docs with warn as error: OFF
Tint build SPIR-V reader: OFF
Tint build WGSL reader: ON
Tint build GLSL writer: OFF
Tint build HLSL writer: OFF
Tint build MSL writer: OFF
Tint build SPIR-V writer: ON
Tint build WGSL writer: ON
Tint build Syntax Tree writer: OFF
Tint build IR: ON
Tint build fuzzers: OFF
Tint build SPIRV-Tools fuzzer: OFF
Tint build AST fuzzer: OFF
Tint build regex fuzzer: OFF
Tint build benchmarks: OFF
Tint build tests: OFF
Tint build checking [chromium-style]: OFF
Tint build remote-compile tool: OFF
Tint external benchmark corpus dir: 
Using python3
CMake Warning (dev) at build/_deps/dawn-src/CMakeLists.txt:334 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Found PythonInterp: C:/Users/user_/AppData/Local/Programs/Python/Python311/python.exe (found suitable version "3.11", minimum required is "3") 
CMake Warning (dev) at build/_deps/dawn-src/third_party/CMakeLists.txt:22 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Running fetch_dawn_dependencies:
-- -- Listing dependencies from C:\dev\webgpu-test\build\_deps\dawn-src
-- -- Fetching dependency 'third_party/vulkan-deps'
-- -- (Overridden by a local copy of the submodule)
-- -- Fetching dependency 'third_party/glfw'
-- -- (Overridden by a local copy of the submodule)
-- -- Fetching dependency 'third_party/abseil-cpp'
-- -- (Overridden by a local copy of the submodule)
-- -- Fetching dependency 'third_party/jinja2'
-- -- (Overridden by a local copy of the submodule)
-- -- Fetching dependency 'third_party/markupsafe'
-- -- (Overridden by a local copy of the submodule)

Dawn: using SPIRV-Headers at C:/dev/webgpu-test/build/_deps/dawn-src/third_party/vulkan-deps/spirv-headers/src
CMake Error at build/_deps/dawn-src/third_party/CMakeLists.txt:44 (add_subdirectory):
  add_subdirectory given source
  "C:/dev/webgpu-test/build/_deps/dawn-src/third_party/vulkan-deps/spirv-headers/src"
  which is not an existing directory.

Dawn: using SPIRV-Tools at C:/dev/webgpu-test/build/_deps/dawn-src/third_party/vulkan-deps/spirv-tools/src
CMake Error at build/_deps/dawn-src/third_party/CMakeLists.txt:69 (add_subdirectory):
  add_subdirectory given source
  "C:/dev/webgpu-test/build/_deps/dawn-src/third_party/vulkan-deps/spirv-tools/src"
  which is not an existing directory.

Dawn: using Abseil at C:/dev/webgpu-test/build/_deps/dawn-src/third_party/abseil-cpp
CMake Error at build/_deps/dawn-src/third_party/CMakeLists.txt:99 (add_subdirectory):
  The source directory

    C:/dev/webgpu-test/build/_deps/dawn-src/third_party/abseil-cpp

  does not contain a CMakeLists.txt file.

Dawn: using Vulkan-Headers at C:/dev/webgpu-test/build/_deps/dawn-src/third_party/vulkan-deps/vulkan-headers/src
CMake Error at build/_deps/dawn-src/third_party/CMakeLists.txt:104 (add_subdirectory):
  add_subdirectory given source
  "C:/dev/webgpu-test/build/_deps/dawn-src/third_party/vulkan-deps/vulkan-headers/src"
  which is not an existing directory.

CMake Warning (dev) at build/_deps/dawn-src/generator/CMakeLists.txt:15 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Found PythonInterp: C:/Users/user_/AppData/Local/Programs/Python/Python311/python.exe (found version "3.11") 
Dawn: using python at C:/Users/user_/AppData/Local/Programs/Python/Python311/python.exe
Dawn: using jinja2 at C:/dev/webgpu-test/build/_deps/dawn-src/third_party/jinja2
Dawn: using markupsafe at C:/dev/webgpu-test/build/_deps/dawn-src/third_party/markupsafe
Configuring incomplete, errors occurred!
eliemichel commented 6 months ago

The log of fetch_dawn_dependencies is suspicious and lacks multiple dependencies. I think the hint is the message "Overridden by a local copy of the submodule", which I believe means that dawn source is cloned with submodules, which it shouldn't. Could you check what the file tree in C:/dev/webgpu-test/build/_deps/dawn-src/third_party looks like? Do you have folders containing only a .git directory?

imadr commented 6 months ago

I tried another machine and it works, I'll try again when I get to my other machine

imadr commented 6 months ago

C:/dev/webgpu-test/build/_deps/dawn-src/third_party

.
..
.clang-format
abseil-cpp
CMakeLists.txt
glfw
gn
go.mod
google_benchmark
jinja2
khronos
markupsafe
vulkan-deps
eliemichel commented 5 months ago

I meant the content of directories as well, in particular whether there is a .git in e.g., abseil-cpp, and where there is a CMakeLists.txt.

Maybe your git is globally setup to always get submodules? You should make sure not to clone submodules when cloning Dawn.

imadr commented 5 months ago

The sub directories are empty. How is dawn supposed to be compiled without the submodules? I tried compiling this repo https://github.com/beaufortfrancois/webgpu-cross-platform-app and had a similar issue until I pulled all the dependencies

imadr commented 4 months ago

For those having the same problem, the solution I found is manually running the script dawn\tools\fetch_dawn_dependencies.py

eliemichel commented 4 months ago

Yes indeed it is that script that is supposed to ensure that dependencies are ready. The WebGPU-distribution files should turn on the CMake option DAWN_FETCH_DEPENDENCIES in order to have this script ran automatically.

If it does not, try forcing this option by adding -DDAWN_FETCH_DEPENDENCIES=ON while calling CMake configuration (or use cmake-gui).

Marking this as resolved since you have a workaround, but if one reads this later and experience the same issue of DAWN_FETCH_DEPENDENCIES not being on by default let us know!