Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build VCMI project because of some locking problem in emscripten ports. (assert 'EM_CACHE_IS_LOCKED') #23457

Open
caiiiycuk opened this issue Jan 18, 2025 · 0 comments

Comments

@caiiiycuk
Copy link
Contributor

Hi, I found a minor problem that prevents me from building the project (VCMI). When I try to do so, I encounter a locking error while building ports. However, if I use embuild to build the ports, I can successfully build the project.

Version of emscripten/emsdk:

  • emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.0 (97c7c2a)
  • 3.1.68

OS: Ubuntu 24.04.1 LTS x64

How to reproduce

git clone https://github.com/caiiiycuk/vcmi-wasm.git
cd vcmi-wasm
git checkout vcmi-wasm-1.6.3
git submodule init
git submodule update

mkdir emscripten
cd emscripten

source ~/sdk/emsdk/emsdk_env.sh 
emcmake cmake -GNinja -DCMAKE_BUILD_TYPE=MinSizeRel  .. 
emcc --clear-ports
ninja boost-lib tbb-lib vcmi-extras
ninja -j32 html5 // error here

error:

caiiiycuk@caiiiycuk-linux:~/vcmi/vcmi-html5/emscripten-2$ ninja -j1 html5
[1/706] cd /home/caiiiycuk/vcmi/vcmi-html5/emscripten-2 && /usr/bin/cmake -DGIT_SHA1="" -P /home/caiiiycuk/vcmi/vcmi-html5/cmake_modules/Version.cmake
-- -- -- Start of Git information
-- GIT_SHA1: e5d305c9ec94b9b05dcae3f97a9d8ef315b1a30c
-- -- -- End of Git information
[2/706] Building CXX object AI/FuzzyLite/fuzzylite/CMakeFiles/fl-obj.dir/src/Benchmark.cpp.o
FAILED: AI/FuzzyLite/fuzzylite/CMakeFiles/fl-obj.dir/src/Benchmark.cpp.o 
/home/caiiiycuk/sdk/emsdk/upstream/emscripten/em++ -DDISABLE_VIDEO -DFL_BACKTRACE -DFL_BUILD_PATH=\"/home/caiiiycuk/vcmi/vcmi-html5\" -DM_BIN_DIR=\".\" -DM_DATA_DIR=\".\" -DM_LIB_DIR=\".\" -DVCMI_HTML5_BUILD -DVCMI_NO_THREADED_LOAD -DVCMI_VERSION_MAJOR=1 -DVCMI_VERSION_MINOR=7 -DVCMI_VERSION_PATCH=0 -DVCMI_VERSION_STRING=\"1.7.0\" -I/home/caiiiycuk/vcmi/vcmi-html5/emscripten-2/boost/include -I/home/caiiiycuk/vcmi/vcmi-html5/emscripten-2/tbb/include -I/home/caiiiycuk/vcmi/vcmi-html5/AI/FuzzyLite/fuzzylite -I/home/caiiiycuk/vcmi/vcmi-html5/include -I/home/caiiiycuk/vcmi/vcmi-html5/lib -I/home/caiiiycuk/vcmi/vcmi-html5 -I/home/caiiiycuk/vcmi/vcmi-html5/AI/FuzzyLite/fuzzylite/. -pedantic -Wall -Wextra  -Wall -Wextra -Wpointer-arith -Wuninitialized -Wmismatched-tags -Wno-unused-parameter -Wno-switch -Wno-reorder -Wno-sign-compare -Wno-varargs -Wno-non-literal-null-conversion -Wno-varargs -Os -DNDEBUG -std=gnu++17   -std=c++11 -fPIC -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -sUSE_SDL_MIXER=2 -sUSE_SDL_TTF=2 -sUSE_ZLIB=1 -pthread -fwasm-exceptions -Oz -fcolor-diagnostics -Wno-error=deprecated-declarations -MD -MT AI/FuzzyLite/fuzzylite/CMakeFiles/fl-obj.dir/src/Benchmark.cpp.o -MF AI/FuzzyLite/fuzzylite/CMakeFiles/fl-obj.dir/src/Benchmark.cpp.o.d -o AI/FuzzyLite/fuzzylite/CMakeFiles/fl-obj.dir/src/Benchmark.cpp.o -c /home/caiiiycuk/vcmi/vcmi-html5/AI/FuzzyLite/fuzzylite/src/Benchmark.cpp
cache:INFO: generating port: sysroot/lib/wasm32-emscripten/libSDL2_ttf-mt.a... (this will be cached in "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/libSDL2_ttf-mt.a" for subsequent builds)
Traceback (most recent call last):
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/emcc.py", line 1660, in <module>
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/emcc.py", line 1653, in main
    ret = run(args)
          ^^^^^^^^^
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/emcc.py", line 670, in run
    linker_inputs = phase_compile_inputs(options, state, newargs, input_files)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/emcc.py", line 1031, in phase_compile_inputs
    cmd = get_clang_command() + inputs
          ^^^^^^^^^^^^^^^^^^^
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/emcc.py", line 992, in get_clang_command
    return compiler + get_cflags(state.orig_args, use_cxx) + compile_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/emcc.py", line 459, in get_cflags
    ports.add_cflags(cflags, settings)
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/tools/ports/__init__.py", line 577, in add_cflags
    port.get(Ports, settings, shared)
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/tools/ports/freetype.py", line 101, in get
    return [shared.cache.get_lib(get_lib_name(settings), create, what='port')]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/tools/cache.py", line 150, in get_lib
    return get(name, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/tools/cache.py", line 168, in get
    with lock(shortname):
  File "/usr/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/home/caiiiycuk/sdk/emsdk/upstream/emscripten/tools/cache.py", line 68, in lock
    acquire_cache_lock(reason)
  File "/home/caiiiycuk/sdk/emsdk/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/libfreetype.a)
em++: error: subprocess 1/1 failed (returned 1)! (cmdline: /home/caiiiycuk/sdk/emsdk/upstream/emscripten/emcc -c /home/caiiiycuk/sdk/emsdk/upstream/emscripten/cache/ports/sdl2_ttf/SDL_ttf-release-2.20.2/SDL_ttf.c -o /home/caiiiycuk/sdk/emsdk/upstream/emscripten/cache/ports-builds/sdl2_ttf/SDL_ttf.c.o -g -sSTRICT -Werror -O2 -I/home/caiiiycuk/sdk/emsdk/upstream/emscripten/cache/ports/sdl2_ttf/SDL_ttf-release-2.20.2 -DTTF_USE_HARFBUZZ=1 -sUSE_SDL=2 -sUSE_FREETYPE -sUSE_HARFBUZZ -pthread)
ninja: build stopped: subcommand failed.
caiiiycuk@caiiiycuk-linux:~/vcmi/vcmi-html5

Related to vcmi#5291

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant