Open Benman2785 opened 2 days ago
Which version of emsdk are you using?
I can't seem to reproduce this running ./embuilder build sdl2 sdl2_ttf sdl2_image sdl2_image_jpg sdl2_image_png
locally:
$ ./embuilder build sdl2 sdl2_ttf sdl2_image sdl2_image_jpg sdl2_image_png --force
embuilder:INFO: building sdl2
cache:INFO: deleting cached file: /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2.a
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2.a... (this will be cached in "/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2.a" for subsequent builds)
system_libs:INFO: compiled 118 inputs in 2.18s
cache:INFO: - ok
embuilder:INFO: ...success. Took (2.31s)
embuilder:INFO: building sdl2_ttf
cache:INFO: deleting cached file: /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_ttf.a
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2_ttf.a... (this will be cached in "/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_ttf.a" for subsequent builds)
system_libs:INFO: compiled 1 inputs in 1.72s
cache:INFO: - ok
embuilder:INFO: ...success. Took (1.81s)
embuilder:INFO: building sdl2_image
cache:INFO: deleting cached file: /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_image.a
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2_image.a... (this will be cached in "/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_image.a" for subsequent builds)
system_libs:INFO: compiled 19 inputs in 0.33s
cache:INFO: - ok
embuilder:INFO: ...success. Took (0.42s)
embuilder:INFO: building sdl2_image_jpg
cache:INFO: deleting cached file: /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_image_jpg.a
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2_image_jpg.a... (this will be cached in "/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_image_jpg.a" for subsequent builds)
system_libs:INFO: compiled 19 inputs in 0.34s
cache:INFO: - ok
embuilder:INFO: ...success. Took (0.43s)
embuilder:INFO: building sdl2_image_png
cache:INFO: deleting cached file: /usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_image_png.a
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2_image_png.a... (this will be cached in "/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_image_png.a" for subsequent builds)
system_libs:INFO: compiled 19 inputs in 0.39s
cache:INFO: - ok
embuilder:INFO: ...success. Took (0.49s)
embuilder:INFO: Built 5 targets in (5.48s)
Can you confirm, that that command is that one that fails for you?
I can reproduce this now:
$ EMCC_CORES=1 ./emcc test/hello_world.c -flto -sUSE_SDL=2 -sUSE_PTHREADS=1 -sUSE_SDL_IMAGE=2 -sSDL2_IMAGE_FORMATS=png
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/lto/libSDL2_image_png.a... (this will be cached in "/usr/local/google/home/sbc/dev/wasm/emscripten/cache/sysroot/lib/wasm32-emscripten/lto/libSDL2_image_png.a" for subsequent builds)
Traceback (most recent call last):
File "/usr/local/google/home/sbc/dev/wasm/emscripten/emcc.py", line 1637, in <module>
sys.exit(main(sys.argv))
^^^^^^^^^^^^^^
File "/usr/lib/python3.11/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/google/home/sbc/dev/wasm/emscripten/emcc.py", line 1630, in main
ret = run(args)
^^^^^^^^^
File "/usr/local/google/home/sbc/dev/wasm/emscripten/emcc.py", line 675, in run
linker_inputs = phase_compile_inputs(options, state, newargs, input_files)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/contextlib.py", line 81, in inner
return func(*args, **kwds)
^^^^^^^^^^^^^^^^^^^
File "/usr/local/google/home/sbc/dev/wasm/emscripten/emcc.py", line 1039, in phase_compile_inputs
cmd = get_clang_command() + inputs
^^^^^^^^^^^^^^^^^^^
File "/usr/local/google/home/sbc/dev/wasm/emscripten/emcc.py", line 1000, in get_clang_command
return compiler + get_cflags(state.orig_args, use_cxx) + compile_args
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/google/home/sbc/dev/wasm/emscripten/emcc.py", line 464, in get_cflags
ports.add_cflags(cflags, settings)
File "/usr/local/google/home/sbc/dev/wasm/emscripten/tools/ports/__init__.py", line 580, in add_cflags
port.get(Ports, settings, shared)
File "/usr/local/google/home/sbc/dev/wasm/emscripten/tools/ports/libpng.py", line 49, in get
return [shared.cache.get_lib(get_lib_name(settings), create, what='port')]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/google/home/sbc/dev/wasm/emscripten/tools/cache.py", line 150, in get_lib
return get(name, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/google/home/sbc/dev/wasm/emscripten/tools/cache.py", line 168, in get
with lock(shortname):
File "/usr/lib/python3.11/contextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "/usr/local/google/home/sbc/dev/wasm/emscripten/tools/cache.py", line 68, in lock
acquire_cache_lock(reason)
File "/usr/local/google/home/sbc/dev/wasm/emscripten/tools/cache.py", line 42, in acquire_cache_lock
assert 'EM_CACHE_IS_LOCKED' not in os.environ, f'attempt to lock the cache while a parent process is holding the lock ({reason})'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: attempt to lock the cache while a parent process is holding the lock (sysroot/lib/wasm32-emscripten/lto/libpng.a)
emcc: error: subprocess 1/19 failed (returned 1)! (cmdline: /usr/local/google/home/sbc/dev/wasm/emscripten/emcc -c /usr/local/google/home/sbc/dev/wasm/emscripten/cache/ports/sdl2_image/SDL_image-release-2.6.0/IMG.c -o /usr/local/google/home/sbc/dev/wasm/emscripten/cache/ports-builds/sdl2_image/IMG.c.o -g -sSTRICT -Werror -flto=full -O2 -I/usr/local/google/home/sbc/dev/wasm/emscripten/cache/ports/sdl2_image/SDL_image-release-2.6.0 -O2 -sUSE_SDL=2 -Wno-format-security -DLOAD_PNG -sUSE_LIBPNG)
Can you try running ./embuilder build sdl2_image_png --lto
. It seems to work as a workaround to build the library up front.
I think this is essentially the same issue as https://github.com/emscripten-core/emscripten/issues/20204
error persists even with --lto or --lto --force
latest emscripten installed today VS2022 installed today
commands for compiling:
File "C:\emsdk-main\upstream\emscripten\tools\cache.py", line 68, in lock acquire_cache_lock(reason) File "C:\emsdk-main\upstream\emscripten\tools\cache.py", line 42, in acquire_cache_lock assert 'EM_CACHE_IS_LOCKED' not in os.environ, f'attempt to lock the cache while a parent process is holding the lock ({reason})' AssertionError: attempt to lock the cache while a parent process is holding the lock (sysroot\lib\wasm32-emscripten\thinlto\libSDL2.a)
googled it and found same error in 2020 and 2023 -> all said its fixed on windows -> but it isnt
actually first time i didnt use
but i restarted pc
full log: emsdk-err.log