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

Build failure: pkgsCross.ghcjs.buildPackages.haskell.compiler.ghc{98,HEAD} #286397

Closed
voidus opened this issue Feb 5, 2024 · 1 comment
Closed

Comments

@voidus
Copy link
Contributor

voidus commented Feb 5, 2024

This is a continuation of #269904 (comment)

Steps To Reproduce

Steps to reproduce the behavior:

  • nix build nixpkgs#pkgsCross.ghcjs.haskell.compiler.ghc98
  • nix build nixpkgs#pkgsCross.ghcjs.haskell.compiler.ghcHEAD

Build log

nix build nixpkgs#pkgsCross.ghcjs.buildPackages.haskell.compiler.ghc98: https://gist.github.com/voidus/8efb39b40ef7722979610bcaa7f902da

Additional context

I built on the PR that came out of the linked thread with what I believed to be the necessary changes. Here's a branch you can check out. For brevity, it includes these changes beyond the PR which adds emscripten_3_1_49:

diff --git a/pkgs/development/compilers/emscripten/3.1.49.nix b/pkgs/development/compilers/emscripten/3.1.49.nix
index 83a8232e734a..cdf468d11050 100644
--- a/pkgs/development/compilers/emscripten/3.1.49.nix
+++ b/pkgs/development/compilers/emscripten/3.1.49.nix
@@ -3,7 +3,7 @@
 , llvmPackages
 , symlinkJoin, makeWrapper, substituteAll
 , buildNpmPackage
-, emscripten
+, emscripten_3_1_49
 }:
 
 stdenv.mkDerivation rec {
@@ -128,7 +128,7 @@ stdenv.mkDerivation rec {
     # HACK: Make emscripten look more like a cc-wrapper to GHC
     # when building the javascript backend.
     targetPrefix = "em";
-    bintools = emscripten;
+    bintools = emscripten_3_1_49;
   };
 
   meta = with lib; {

and

diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix
index f4d2a279a678..24ed2d0ea4fe 100644
--- a/pkgs/development/compilers/ghc/common-hadrian.nix
+++ b/pkgs/development/compilers/ghc/common-hadrian.nix
@@ -211,7 +211,7 @@ let
   # GHC doesn't seem to have {LLC,OPT}_HOST
   toolsForTarget = [
     (if targetPlatform.isGhcjs
-     then pkgsBuildTarget.emscripten
+     then pkgsBuildTarget.emscripten_3_1_49
      else pkgsBuildTarget.targetPackages.stdenv.cc)
   ] ++ lib.optional useLLVM buildTargetLlvmPackages.llvm;

There is no other mention of emscripten in the ghc folder

Sadly, this returns us to the original problem of configure: error: sub-word-sized atomic operations are not available., which as far as I can see is the misreported emscripten cache directory issue.

nix build github:voidus/nixpkgs/ghcjs-build-failure#pkgsCross.ghcjs.buildPackages.haskell.compiler.ghc98:

Notable excerpt from config.log:

cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/libstubs.a... (this will be cached in "/build/ghc-9.8.1/emcache.p7GU4z5VJu/sysroot/lib/wasm32-emscripten/libstubs.a" for subsequent builds)
Traceback (most recent call last):
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/emcc.py", line 4579, in <module>
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/emcc.py", line 4572, in main
    ret = run(args)
          ^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/emcc.py", line 1341, in run
    linker_inputs = phase_compile_inputs(options, state, newargs, input_files)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/emcc.py", line 3062, in phase_compile_inputs
    system_libs.ensure_sysroot()
  File "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/contextlib.py", line 81, in inner
Traceback (most recent call last):
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/emcc.py", line 4579, in <module>
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/tools/system_libs.py", line 2382, in ensure_sysroot
    cache.get('sysroot_install.stamp', install_system_headers, what='system headers')
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/tools/cache.py", line 157, in get
    with lock(shortname):
  File "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/tools/cache.py", line 61, in lock
    acquire_cache_lock(reason)
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/tools/cache.py", line 35, 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_install.stamp)
    sys.exit(main(sys.argv))
             ^^^^^^^^^^^^^^
  File "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/emcc.py", line 4572, in main
    ret = run(args)
          ^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/emcc.py", line 1341, in run
    linker_inputs = phase_compile_inputs(options, state, newargs, input_files)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/emcc.py", line 3062, in phase_compile_inputs
    system_libs.ensure_sysroot()
  File "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/contextlib.py", line 81, in inner
    return func(*args, **kwds)
           ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/tools/system_libs.py", line 2382, in ensure_sysroot
    cache.get('sysroot_install.stamp', install_system_headers, what='system headers')
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/tools/cache.py", line 157, in get
    with lock(shortname):
  File "/nix/store/5k91mg4qjylxbfvrv748smfh51ppjq0g-python3-3.11.6/lib/python3.11/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/tools/cache.py", line 61, in lock
    acquire_cache_lock(reason)
  File "/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/tools/cache.py", line 35, 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_install.stamp)
emcc: error: Subprocess 1/2 failed (returned 1)! (cmdline: /nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/bin/emcc -c -O2 -Wall -fno-unroll-loops -g -sSTRICT -Werror -I/nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/system/lib/libc/musl/src/include -DNDEBUG ../../../../../nix/store/yvjcq2yrkn6c6qp3rnq1n9vabpvqawdk-emscripten-3.1.49/share/emscripten/system/lib/libc/emscripten_syscall_stubs.c)

Since the cache directory is in /build, I assume that this is not the issue, so in my understanding, either we are running nested emccs or the environment variables aren't handled properly.

Notify maintainers

@guibou @cdepillabout @expipiplus1 @maralorn @ncfavier @sternenseemann

(Sorry if this is excessive, please let me know)

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.8-arch1-1, Arch Linux, noversion, rolling`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.19.1`
 - channels(root): `""`
 - channels(voyd): `"home-manager, nixpkgs"`
 - channels(testie): `"nixpkgs"`
 - nixpkgs: `/home/voyd/.nix-defexpr/channels/nixpkgs`

Add a 👍 reaction to issues you find important.

@wegank wegank changed the title Build failure: pgksCross.ghcjs.buildPackages.haskell.compiler.ghc{98,HEAD} Build failure: pkgsCross.ghcjs.buildPackages.haskell.compiler.ghc{98,HEAD} Feb 5, 2024
@sternenseemann
Copy link
Member

#302887 fixes the cache problems with the newer emcsripten. We'll have to wait for #302552 which fixes an unrelated problem in LLVM for ghcjs.

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

No branches or pull requests

3 participants