Hi, After days of hard work I finally worked out how to compile maplibre-native as a WASM side module, roughly 40MB (without optimisations). At the moment the file size doesn't worry me much.
maplibre-native is compiled using C++ 17 whereas my main module is compiled using C++ 23. Is this generally allowed? Might this be why I'm getting: LinkError: WebAssembly.instantiate(): Import #7289 "env" "_ZNSt3__26chrono12steady_clock3nowEv": imported function does not match the expected type Please note, I am using CMake. # SIDE_MODULE set(CMAKE_EXECUTABLE_SUFFIX ".wasm") set_target_properties(mbgl-core PROPERTIES COMPILE_FLAGS "-O0 -pthread -fPIC --use-port=libpng --use-port=libjpeg --use-port=zlib --use-port=sqlite3 -s DISABLE_EXCEPTION_CATCHING=0 -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 -DMLN_RENDER_BACKEND_OPENGL -DMLN_DRAWABLE_RENDERER") set_target_properties(mbgl-core PROPERTIES LINK_FLAGS "--no-heap-copy -pthread -fPIC --use-port=libpng --use-port=libjpeg --use-port=zlib --use-port=sqlite3 -O0 -lembind -lhtml5.js -lhtml5_webgl.js -lglfw.js -s ENVIRONMENT='web,worker' -s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -s USE_GLFW=3 -s USE_WEBGPU=1 -s STANDALONE_WASM=1 -s ASSERTIONS=1 -s STACK_OVERFLOW_CHECK=2 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -sFULL_ES3 -s EXPORT_ALL=1 -s DISABLE_EXCEPTION_CATCHING=0 -s SINGLE_FILE=0 -sSIDE_MODULE") # MAIN MODULE set_target_properties(reactDearImgui PROPERTIES COMPILE_FLAGS "-O3 -pthread -fPIC -Wno-error=deprecated-declarations -Wformat -s DISABLE_EXCEPTION_CATCHING=0 --use-port=libpng --use-port=sqlite3 --use-port=libjpeg --use-port=zlib") set_target_properties(reactDearImgui PROPERTIES LINK_FLAGS "--no-heap-copy -pthread -fPIC --use-port=sqlite3 --use-port=libpng --use-port=libjpeg --use-port=zlib -O3 -lembind -lhtml5.js -lhtml5_webgl.js -lglfw.js -s DISABLE_EXCEPTION_CATCHING=0 -s ENVIRONMENT='web,worker' -s MODULARIZE=1 -s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -s USE_GLFW=3 -s USE_WEBGPU=1 -s NO_EXIT_RUNTIME=0 -s STANDALONE_WASM=0 -s EXIT_RUNTIME=1 -s ASSERTIONS=1 -s STACK_OVERFLOW_CHECK=2 -s MIN_WEBGL_VERSION=2 -s MAX_WEBGL_VERSION=2 -sFULL_ES3 -s DISABLE_EXCEPTION_CATCHING=0 -s SINGLE_FILE=0 -sERROR_ON_UNDEFINED_SYMBOLS=0 -s EXPORT_ALL=1 -sMAIN_MODULE ${CMAKE_CURRENT_SOURCE_DIR}/deps/maplibre-native-fork/platform/emscripten/build/mbgl-core.wasm") Any help with this would be greatly appreciated. I apologise in advance if the solution turns out to be trivial. -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/aa75bf86-3c32-40d8-b059-8efc645ca96dn%40googlegroups.com.