eliemichel / WebGPU-distribution

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

cmake would not work on macOS with dawn #29

Open conversy opened 3 months ago

conversy commented 3 months ago

Hello,

I got the error below when running cmake as specified in the README.md:

cmake -B build-dawn -DWEBGPU_BACKEND=DAWN

I found here that running this command before the cmake command would make it work:

export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)

Maybe it's worth adding it in README.md?

Still, running the next command:

cmake --build build-dawn

would return immediately, building nothing... Maybe I did something wrong? It's on my mac M1, latest OS (sonoma 14.5 (23F79)) with Apple clang version 15.0.0 (clang-1500.3.9.4)

Best regards,

Stéphane

The error:

$ cmake -B build-dawn -DWEBGPU_BACKEND=DAWN
-- The C compiler identification is AppleClang 15.0.0.15000309
-- The CXX compiler identification is AppleClang 15.0.0.15000309
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.29.0/share/cmake/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/Users/conversy/Downloads/WebGPU-distribution-dawn-6512/build-dawn/CMakeFiles/CMakeScratch/TryCompile-OOLQ0B'

    Run Build Command(s): /opt/homebrew/Cellar/cmake/3.29.0/bin/cmake -E env VERBOSE=1 /opt/homebrew/bin/gmake -f Makefile cmTC_0d439/fast
    /opt/homebrew/bin/gmake  -f CMakeFiles/cmTC_0d439.dir/build.make CMakeFiles/cmTC_0d439.dir/build
    gmake[1]: Entering directory '/Users/conversy/Downloads/WebGPU-distribution-dawn-6512/build-dawn/CMakeFiles/CMakeScratch/TryCompile-OOLQ0B'
    Building C object CMakeFiles/cmTC_0d439.dir/testCCompiler.c.o
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc    -MD -MT CMakeFiles/cmTC_0d439.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_0d439.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_0d439.dir/testCCompiler.c.o -c /Users/conversy/Downloads/WebGPU-distribution-dawn-6512/build-dawn/CMakeFiles/CMakeScratch/TryCompile-OOLQ0B/testCCompiler.c
    Linking C executable cmTC_0d439
    /opt/homebrew/Cellar/cmake/3.29.0/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0d439.dir/link.txt --verbose=1
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/cmTC_0d439.dir/testCCompiler.c.o -o cmTC_0d439
    ld: library 'System' not found
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    gmake[1]: *** [CMakeFiles/cmTC_0d439.dir/build.make:100: cmTC_0d439] Error 1
    gmake[1]: Leaving directory '/Users/conversy/Downloads/WebGPU-distribution-dawn-6512/build-dawn/CMakeFiles/CMakeScratch/TryCompile-OOLQ0B'
    gmake: *** [Makefile:127: cmTC_0d439/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)

-- Configuring incomplete, errors occurred!