When building a simple C++ Module which includes SDL headers emscripten fails at scanning its dependencies. I'm not sure if this is because CMake utilizes the system binaries instead of the one that gets shipped with EMSDK but a native build compiles successfully.
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.58 (a41843e0860e52c948c1fce20307933c6631c800)
clang version 19.0.0git (https:/github.com/llvm/llvm-project 0a8cd1ed1f4f35905df318015b0dbcb69d81d7c2)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /mnt/e/Workspace/Diyou.Engine/.cache/emsdk/upstream/bin
Failing command line in full:
[main] Building folder: Diyou.Engine
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /mnt/e/Workspace/Diyou.Engine/build/Debug.WASM --target Tests
[build] [1/7] Scanning /mnt/e/Workspace/Diyou.Engine/Modules/Window.cppm for CXX dependencies
[build] FAILED: CMakeFiles/Diyou.dir/Modules/Window.cppm.o.ddi
[build] "/usr/bin/clang-scan-deps" -format=p1689 -- /mnt/e/Workspace/Diyou.Engine/.cache/emsdk/upstream/emscripten/em++ -I/mnt/e/Workspace/Diyou.Engine/build/Debug.WASM/.cache/SDL3/include -I/mnt/e/Workspace/Diyou.Engine/.cache/SDL3/include -I/mnt/e/Workspace/Diyou.Engine/.cache/SDL3/include/SDL3 -g -std=c++23 -flto=thin -fPIC -sUSE_SDL=0 -idirafter/mnt/e/Workspace/Diyou.Engine/.cache/SDL3/src/video/khronos -x c++ /mnt/e/Workspace/Diyou.Engine/Modules/Window.cppm -c -o CMakeFiles/Diyou.dir/Modules/Window.cppm.o -MT CMakeFiles/Diyou.dir/Modules/Window.cppm.o.ddi -MD -MF CMakeFiles/Diyou.dir/Modules/Window.cppm.o.ddi.d > CMakeFiles/Diyou.dir/Modules/Window.cppm.o.ddi.tmp && mv CMakeFiles/Diyou.dir/Modules/Window.cppm.o.ddi.tmp CMakeFiles/Diyou.dir/Modules/Window.cppm.o.ddi
[build] error: unknown argument: '-sUSE_SDL=0'
[build] Error while scanning dependencies for /mnt/e/Workspace/Diyou.Engine/Modules/Window.cppm:
[build] error: unknown argument: '-sUSE_SDL=0'
[build] In file included from /mnt/e/Workspace/Diyou.Engine/Modules/Window.cppm:2:
[build] In file included from /mnt/e/Workspace/Diyou.Engine/.cache/SDL3/include/SDL3/SDL.h:32:
[build] /mnt/e/Workspace/Diyou.Engine/.cache/SDL3/include/SDL3/SDL_stdinc.h:36:10: fatal error: 'stdarg.h' file not found
[build] ninja: build stopped: subcommand failed.
[proc] The command: /usr/bin/cmake --build /mnt/e/Workspace/Diyou.Engine/build/Debug.WASM --target Tests exited with code: 1
[driver] Build completed: 00:00:00.192
[build] Build finished with exit code 1
When building a simple C++ Module which includes SDL headers emscripten fails at scanning its dependencies. I'm not sure if this is because CMake utilizes the system binaries instead of the one that gets shipped with EMSDK but a native build compiles successfully.
Version of emscripten/emsdk: emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.58 (a41843e0860e52c948c1fce20307933c6631c800) clang version 19.0.0git (https:/github.com/llvm/llvm-project 0a8cd1ed1f4f35905df318015b0dbcb69d81d7c2) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /mnt/e/Workspace/Diyou.Engine/.cache/emsdk/upstream/bin
Failing command line in full: