Closed StormLord07 closed 2 weeks ago
Either the issue with linker/compiler or how CMake concatenates vars, unfortunately CMake is the only way how I can interact with compilers and generators provided by MSVC without having to butcher my $PATH, so I can't check which, never before I encountered this error.
A little more experimenting it seems to be a problem with how arguments are handled, spaces don't work well with both cmake and emcc, em++ changing LINK_FLAGS to
set(LINK_FLAGS "-s" "ASSERTIONS=0" "--preload-file" "${ASSET_DIR}@/res")
"fixes" the issue
I recommend using -sASSERTIONS=0
(without the space), and --preload-file=${ASSET_DIR}@/res
(again without a space), especially when using cmake.
Also, with linker flags such as -sASSERTIONS=0
and --preload-file
you don't really want to add them to CMAKE_CXX_FLAGS_RELEASE or CMAKE_CXX_FLAGS_DEBUG since those used for compiler sources. When adding link flags you should use CMAKE_EXE_LINKER_FLAGS
or target_link_options
(https://cmake.org/cmake/help/latest/command/target_link_options.html)
Version of emscripten/emsdk: emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.64 (a1fe3902bf73a3802eae0357d273d0e37ea79898) clang version 19.0.0git (https:/github.com/llvm/llvm-project 4d8e42ea6a89c73f90941fd1b6e899912e31dd34) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: C:\libs\emsdk\upstream\bin
Cmake Generator: Ninja
Failing command line in full: 2 almost identical cmake files
and
Full link command and output with
-v
appended: CMake №1 link commandcompile command
CMake №2 link command
compile command
Error desciption
1st cmake builds with no warnings however no file can be loaded on frontend
2nd cmake warns out every file
-Wunused-command-line-argument
however only then files can be loaded on frontend