Open FrostKiwi opened 1 year ago
Removed SDL_Image only to find, that SDL2 itself doesn't manage to compile with -s WASM_WORKERS
:[
Even after emcc --clear-cache
and having SDL2 recompile, it ends up with the same error:
wasm-ld: error: --shared-memory is disallowed by SDL_atomic.c.o because it was not compiled with 'atomics' or 'bulk-memory' features.
@sbc100 Ohh wow, the issue is actually kind of strange. I can build my App with -s USE_SDL=2
and -s WASM_WORKERS
with LTO
enabled!
https://github.com/emscripten-core/emscripten/pull/18167 had a regression or something?
@sbc100 Ohh wow, the issue is actually kind of strange. I can build my App with
-s USE_SDL=2
and-s WASM_WORKERS
withLTO
enabled!
- Compiles: -O0 -flto, -O1 -flto, -O2 -flto, -O3 -flto
- Does not compile: -O0, -O1, -O2, -O3
18167 had a regression or something?
@FrostKiwi Does SDL2_image works with -s WASM_WORKERS?
On emscripten 3.1.47 it still doesn't work. Get the same error as you do.
I met the same error on 3.1.61 (with only --use-port=sdl2) and I fixed the issue with the following hack.
tools/ports/sdl2.py
includes = [ports.get_include_dir('SDL2')]
if settings.PTHREADS:
flags += ['-pthread']
+ if settings.SHARED_MEMORY:
+ flags += ['-matomics', '-mbulk-memory']
ports.build_port(src_dir, final, 'sdl2', srcs=srcs, includes=includes, flags=flags)
Then I found that I have to deal with 'SharedArrayBuffer' error which would need to change to https://, wss://.. It seems that with security it will slow down everything..
Adding either
-sWASM_WORKERS
in my Makefile here: https://github.com/FrostKiwi/frostorama/blob/751cb0bdf99de609db57cb4134991d8b09135652/Makefile#L43 or-pthread
in the c flags here https://github.com/FrostKiwi/frostorama/blob/751cb0bdf99de609db57cb4134991d8b09135652/Makefile#L11 causeswasm-ld: error: --shared-memory is disallowed by SDL_atomic.c.o because it was not compiled with 'atomics' or 'bulk-memory' features.
and breaks compilation. With-s SDL2_IMAGE_FORMATS='["jpg", "png", "heic"]'
enabled, the error message becomes:wasm-ld: error: --shared-memory is disallowed by IMG_jpg.c.o because it was not compiled with 'atomics' or 'bulk-memory' features.
I assume https://github.com/emscripten-core/emscripten/pull/18379 has to be used instead of master to get this working.
Version of emscripten/emsdk
```console emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.38 (9eff02bc816c50ab0e3b70a3bd5b72a8dc2893a2) clang version 17.0.0 (https://github.com/llvm/llvm-project 004bf170c6cbaa049601bcf92f86a9459aec2dc2) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: C:\