Closed Sakari369 closed 1 year ago
Adding the following definition -sLEGACY_RUNTIME=1 into CMakeLists.txt fixes the linking:
# Emscripten-specific linker options
if (CMAKE_SYSTEM_NAME STREQUAL Emscripten)
set(CMAKE_EXECUTABLE_SUFFIX ".html")
# use our own minimal shell.html
target_link_options(demo PRIVATE --shell-file ../sokol/shell.html)
# WASM+JS size optimizations
target_link_options(demo PRIVATE -sLEGACY_RUNTIME=1 -sNO_FILESYSTEM=1 -sASSERTIONS=0 -sMALLOC=emmalloc --closure=1)
endif()
As mentioned by Emscripten ChangeLog (https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md):
The LEGACY_RUNTIME setting is no longer enabled by default. If you use any of these legacy runtime functions (except in library code with explicit dependencies) then you would need to set LEGACY_RUNTIME on the command line or add the ones you need to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE:
Ah yes, this was a quite recent Emscripten change. I had fixed this in the sokol headers using a new Emscripten feature (EM_JS_DEPS macro), but haven't updated the sokol headers everywhere yet. I just did this, so it should be fixed now (tested on my machine with emsdk 3.1.24 (you need this latest version because of EM_JS_DEPS).
Nice! And continue the good work, was just admiring your code quality 👌
Building the project with
Fails currently with the message:
Running macOS Ventura 13.0 with Emscripten stable 3.1.24.
Probably fails as there were some recent changes in Emscripten and ccall.