nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

mastodon-modules: build failure

Open siflfran opened this issue 1 year ago • 2 comments

Nixpkgs version

  • Unstable (25.05)

Describe the bug

mastodon-modules fails in fixupPhase.

Steps to reproduce

nix-shell -p mastodon

Expected behaviour

mastodon-modules builds without error

Screenshots

No response

Relevant log output

Running phase: fixupPhase
shrinking RPATHs of ELF executables and libraries in /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3
shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/prebuilds/linux-x64/utf-8-validate.node
shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/prebuilds/linux-x64/utf-8-validate.musl.node
shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/build/Release/validation.node
shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/build/Release/obj.target/validation.node
shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/build/Release/obj.target/validation/src/validation.o
patchelf: wrong ELF type
shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/build/Release/obj.target/validation/deps/is_utf8/src/is_utf8.o
patchelf: wrong ELF type
shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/bufferutil/prebuilds/linux-x64/node.napi.node
checking for references to /build/ in /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3...
patchelf: wrong ELF type
patchelf: wrong ELF type
patching script interpreter paths in /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3
ERROR: noBrokenSymlinks: the symlink /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/@mastodon/streaming points to a missing target /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/streaming
ERROR: noBrokenSymlinks: found 1 dangling symlinks and 0 reflexive symlinks
error: builder for '/nix/store/nkvhwanxyldkkfyma1wzxrh60id2qq8m-mastodon-modules-4.3.3.drv' failed with exit code 1;
       last 25 log lines:
       > DEPRECATION WARNING: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.
       >
       > More info: https://sass-lang.com/d/legacy-js-api
       >
       >
       > ➤ YN0000: Done in 0s
       > buildPhase completed in 58 seconds
       > Running phase: installPhase
       > Running phase: fixupPhase
       > shrinking RPATHs of ELF executables and libraries in /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3
       > shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/prebuilds/linux-x64/utf-8-validate.node
       > shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/prebuilds/linux-x64/utf-8-validate.musl.node
       > shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/build/Release/validation.node
       > shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/build/Release/obj.target/validation.node
       > shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/build/Release/obj.target/validation/src/validation.o
       > patchelf: wrong ELF type
       > shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/utf-8-validate/build/Release/obj.target/validation/deps/is_utf8/src/is_utf8.o
       > patchelf: wrong ELF type
       > shrinking /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/bufferutil/prebuilds/linux-x64/node.napi.node
       > checking for references to /build/ in /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3...
       > patchelf: wrong ELF type
       > patchelf: wrong ELF type
       > patching script interpreter paths in /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3
       > ERROR: noBrokenSymlinks: the symlink /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/node_modules/@mastodon/streaming points to a missing target /nix/store/ghwp2jgvs9h8k6r4csvkka7ydkqw5ym1-mastodon-modules-4.3.3/streaming
       > ERROR: noBrokenSymlinks: found 1 dangling symlinks and 0 reflexive symlinks
       For full logs, run 'nix log /nix/store/nkvhwanxyldkkfyma1wzxrh60id2qq8m-mastodon-modules-4.3.3.drv'.
error: 1 dependencies of derivation '/nix/store/akb60ys3f7yjjd913r0spfajy02p8jnr-mastodon-4.3.3.drv' failed to build

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.13.1, NixOS, 25.05 (Warbler), 25.05.20250207.dd81bdc
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.25.5
  • channels(…): "home-manager, nixgl, nixpkgs"
  • channels(root): "nixos"
  • nixpkgs: /home/…/.nix-defexpr/channels/nixpkgs

Notify maintainers

@erictapen @Izorkin @ghuntley @happy-river

Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a :+1: reaction to issues you find important.

siflfran avatar Feb 08 '25 13:02 siflfran

Likely root cause of issue is here: #370750 (stdenv: add no-broken-symlinks hook #370750)

The hook can be disabled by setting dontCheckForBrokenSymlinks , but that is an ugly workaround, not a real fix.

Correct solution is to fix the dangling symlink issue in the mastodon-modules-4.3.3 code.

MarkRijckenberg avatar Feb 09 '25 10:02 MarkRijckenberg

The symlink causing the failure is created by yarn for the streaming workspace. I'm not quite sure why that is, the root workspace doesn't depend on streaming directly.

But even if its intended by upstream in some way the link would be useless in our build, it can be removed safely. A fix could look like this

services.mastodon.package = pkgs.mastodon.overrideAttrs (old: {
  mastodonModules = old.mastodonModules.overrideAttrs (old: {
    # FIXME: Remove once fixed in nixpkgs. See https://github.com/NixOS/nixpkgs/issues/380366
    postBuild = ''
      # Remove workspace "package" as it contains broken symlinks
      rm -r ~/node_modules/@mastodon
    '';
  });
});

Ideally we could just tell yarn to not create the link though

networkException avatar Feb 09 '25 10:02 networkException