Open tmyqlfpir opened 1 year ago
The problem seems to be related to fact the sdl2 library has a pthread-variant but that sdl2_mixer does not.
As a workaround, until with come up with better fix, you should be able to build needed dependency by first building without -sUSE_PTHREADS
Thanks! That works for the sdl2 mixer example, but for the open source game it'll eventually hit the linker stage, then print the following error:
--shared-memory is disallowed by SDL_atomic.c.o because it was not compiled with 'atomics' or 'bulk-memory' features.
I am not sure how to progress as the game requires atomics and pthreads, and I've been able to compile it thus far.
What I mean is if you build libsdl
first without threads then you shouldn't run into this issue. Its a workaround but it should work. The final build should not change. You can continue to use -sUSE_PTHREADS
there.
For example, you could add ./embuilder build sdl2
to your build script, before you compile anything.
Note my analysis here re: the cache being locked.
Hello.
I am attempting to compile a open source game that uses SDL2, but whenever it attempts to compile the required SDL2_mixer library it always fails at timidity. I've isolated the problem by using an barebones SDL2 mixer example project, which is attached to this issue (originally from here).
sdl2-mixer-sample-src.zip
The example project is compiled with the following command in the base directory.
emcc ./src/main.c -s USE_OGG=1 -s USE_VORBIS=1 -s USE_PTHREADS -s USE_SDL=2 -s USE_SDL_MIXER=2 -s SDL2_MIXER_FORMATS='["wav", "ogg"]' -s INITIAL_MEMORY=64MB -s ASYNCIFY=1 --preload-file ./assets -o ./test.html
I am using lubuntu within VirtualBox, and have ran --clear-cache before attempting to compile to html.
Version of emscripten/emsdk:
Failing command line in full:
``` emcc ./src/main.c -s USE_OGG=1 -s USE_VORBIS=1 -s USE_PTHREADS -s USE_SDL=2 -s USE_SDL_MIXER=2 -s SDL2_MIXER_FORMATS='["wav", "ogg"]' -s INITIAL_MEMORY=64MB -s ASYNCIFY=1 --preload-file ./assets -o ./test.html shared:INFO: (Emscripten: Running sanity checks) cache:INFO: generating system headers: sysroot_install.stamp... (this will be cached in "/home/user/Downloads/emsdk/upstream/emscripten/cache/sysroot_install.stamp" for subsequent builds) cache:INFO: - ok ports:INFO: retrieving port: sdl2 from https://github.com/libsdl-org/SDL/archive/release-2.24.0.zip ports:INFO: unpacking port: sdl2 cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2-mt.a... (this will be cached in "/home/user/Downloads/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2-mt.a" for subsequent builds) system_libs:INFO: compiled 114 inputs cache:INFO: - ok ports:INFO: retrieving port: ogg from https://github.com/emscripten-ports/ogg/archive/version_1.zip ports:INFO: unpacking port: ogg cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/libogg.a... (this will be cached in "/home/user/Downloads/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libogg.a" for subsequent builds) root:INFO: building port: ogg system_libs:INFO: compiled 2 inputs cache:INFO: - ok ports:INFO: retrieving port: vorbis from https://github.com/emscripten-ports/vorbis/archive/version_1.zip ports:INFO: unpacking port: vorbis cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/libvorbis.a... (this will be cached in "/home/user/Downloads/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libvorbis.a" for subsequent builds) root:INFO: building port: vorbis system_libs:INFO: compiled 22 inputs cache:INFO: - ok ports:INFO: retrieving port: sdl2_mixer from https://github.com/libsdl-org/SDL_mixer/archive/release-2.0.4.zip ports:INFO: unpacking port: sdl2_mixer cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2_mixer_ogg-wav.a... (this will be cached in "/home/user/Downloads/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_mixer_ogg-wav.a" for subsequent builds) root:INFO: building port: sdl2_mixer Traceback (most recent call last): File "/home/user/Downloads/emsdk/upstream/emscripten/emcc.py", line 4145, inFull link command and output with `-v` appended.log
* Too big to include into issue, attached here: [compile.log](https://github.com/emscripten-core/emscripten/files/9827286/compile.log)