nmattia / niv

Easy dependency management for Nix projects

Home Page:https://github.com/nmattia/niv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linker error

573 opened this issue · comments

When using ${self.niv} in an overlay on aarch64 (see full.log here: https://paste.c-net.org/ekjy1vngqsuf) I currently get:

/nix/store/vlhkqnrml6gcl2f5yndgwpcqwxa177px-binutils-2.35.1/bin/ld.gold: error: /lib: can not read directory: Permission denied
collect2: error: ld returned 1 exit status

  • system: "aarch64-linux"
  • host os: Linux 4.4.111-21427293
  • multi-user?: no
  • sandbox: no
  • version: nix-env (Nix) 2.3.15
  • channels(nix-on-droid): "nix-on-droid-21.05, nixpkgs-21.05.2796.110a2c9ebbf"
  • nixpkgs: /data/data/com.termux.nix/files/home/.nix-defexpr/channels/nixpkgs

Do Haskell packages normally build out of the box on aarch64? for now I guess we could mark it as broken

@nmattia nix now works natively on aarch64-darwin, and a lot of Haskell packages are building just file: see NixOS/nixpkgs#95903 (comment)

there is a hydra jobset which builds 21.05 and unstable channels for aarch64-darwin. Niv seems to build on unstable, however nix throws an error at the end of the build due to reference cycles:

stripping (with command strip and flags -S) in /nix/store/z3f8wkdcy1b0zx2ijh4194ga1d38p813-niv-0.2.19-bin/bin 
patching script interpreter paths in /nix/store/z3f8wkdcy1b0zx2ijh4194ga1d38p813-niv-0.2.19-bin
cycle detected in the references of '/nix/store/9qqxm0dnfcfmwm7yqm48bi40sip4i113-niv-0.2.19' from '/nix/store/z3f8wkdcy1b0zx2ijh4194ga1d38p813-niv-0.2.19-bin'

see: https://hydra.nixos.org/build/155772021/nixlog/1

any idea why could that be?

No idea from the top of my head. Does it work when building from the repo, but replacing pkgs with unstable?

@nmattia I didn’t try building from the repo but managed to “fix” the issue on unstable with this commit: rhinofi/nixpkgs@3277b0f

No idea why this is causing issues on aarch64 specifically.

I employed @adrian-gierakowski's workaround in an overlay with the following:

(self: super: {
  # https://github.com/nmattia/niv/issues/332#issuecomment-958449218
  niv =
    self.haskell.lib.compose.overrideCabal
      (drv: { enableSeparateBinOutput = false; })
      super.haskellPackages.niv;
})

I looked into this a bit:

$ drv=$(nix-instantiate -A haskellPackages.niv )
$ nix --extra-experimental-features nix-command show-derivation $drv | jq '."'$drv'".outputs'
{
  "bin": {
    "path": "/nix/store/6ma1wknhwrgpi77wgny079304zam0khd-niv-0.2.19-bin"
  },
  "data": {
    "path": "/nix/store/g6ii9zp8phdi3j3g0bl2vy6mzwdixqak-niv-0.2.19-data"
  },
  "doc": {
    "path": "/nix/store/589wjpwivcpb0n71sn87kbl9bn8wzknv-niv-0.2.19-doc"
  },
  "out": {
    "path": "/nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19"
  }
}
$ bin=/nix/store/6ma1wknhwrgpi77wgny079304zam0khd-niv-0.2.19-bin
$ out=/nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19
$ grep -r $bin $out
/nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/nix-support/propagated-build-inputs:/nix/store/i3qqzk0a55pg5l1iqfiw36b2m95jcjy2-aeson-1.5.6.0 /nix/store/66w9z3fccgd7lb8d9p8dz49gp4mldra1-aeson-pretty-0.8.9 /nix/store/bk1ddhakjz647483gbl7m3r147b55zby-ansi-terminal-0.11.1 /nix/store/ss88qxgzwazvxdag9ig4wnycx2dc8ifl-file-embed-0.0.15.0 /nix/store/74y7876mk279iydwmc2g0kmzprmik2k8-hashable-1.3.0.0 /nix/store/58gqfykqslyq5kv4jczkap71rf7h2wkn-http-conduit-2.3.8 /nix/store/cavijnbja10hxcgl4gfvbh6259dchrdm-optparse-applicative-0.15.1.0 /nix/store/76ddwz1zpvdpgi1ppva99v5gcg3gcd79-profunctors-5.6.2 /nix/store/y0ndm94vv30j4ssc3vlidi2cvg3vvhjs-pureMD5-2.1.4 /nix/store/kpz25wmaqlalarms0vzzfs4d43mc5p3c-string-qq-0.0.4 /nix/store/6b5yylwcpxshgg135v2j9akzsnmd4044-tasty-1.4.2.1 /nix/store/wlmgljnh0093w376zlms9sw8ycw5h985-tasty-hunit-0.10.0.3 /nix/store/8cgjbyaj2rb11x5nq0a06dbzcd3jykwh-unliftio-0.2.20 /nix/store/gmrsjymwbnx6sm1al1pqyvd30h7ibl6a-unordered-containers-0.2.16.0 /nix/store/i3qqzk0a55pg5l1iqfiw36b2m95jcjy2-aeson-1.5.6.0 /nix/store/66w9z3fccgd7lb8d9p8dz49gp4mldra1-aeson-pretty-0.8.9 /nix/store/bk1ddhakjz647483gbl7m3r147b55zby-ansi-terminal-0.11.1 /nix/store/ss88qxgzwazvxdag9ig4wnycx2dc8ifl-file-embed-0.0.15.0 /nix/store/74y7876mk279iydwmc2g0kmzprmik2k8-hashable-1.3.0.0 /nix/store/58gqfykqslyq5kv4jczkap71rf7h2wkn-http-conduit-2.3.8 /nix/store/cavijnbja10hxcgl4gfvbh6259dchrdm-optparse-applicative-0.15.1.0 /nix/store/76ddwz1zpvdpgi1ppva99v5gcg3gcd79-profunctors-5.6.2 /nix/store/y0ndm94vv30j4ssc3vlidi2cvg3vvhjs-pureMD5-2.1.4 /nix/store/kpz25wmaqlalarms0vzzfs4d43mc5p3c-string-qq-0.0.4 /nix/store/8cgjbyaj2rb11x5nq0a06dbzcd3jykwh-unliftio-0.2.20 /nix/store/gmrsjymwbnx6sm1al1pqyvd30h7ibl6a-unordered-containers-0.2.16.0  /nix/store/6ma1wknhwrgpi77wgny079304zam0khd-niv-0.2.19-bin
Binary file /nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/lib/ghc-8.10.7/aarch64-osx-ghc-8.10.7/niv-0.2.19-3erUdXeYgUx22sPFJG6N5H/Paths_niv.hi matches
Binary file /nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/lib/ghc-8.10.7/aarch64-osx-ghc-8.10.7/niv-0.2.19-3erUdXeYgUx22sPFJG6N5H/Paths_niv.dyn_hi matches
Binary file /nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/lib/ghc-8.10.7/aarch64-osx-ghc-8.10.7/niv-0.2.19-3erUdXeYgUx22sPFJG6N5H/libHSniv-0.2.19-3erUdXeYgUx22sPFJG6N5H.a matches
Binary file /nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/lib/ghc-8.10.7/aarch64-osx-ghc-8.10.7/libHSniv-0.2.19-3erUdXeYgUx22sPFJG6N5H-ghc8.10.7.dylib matches
$ grep -r $out $bin
Binary file /nix/store/6ma1wknhwrgpi77wgny079304zam0khd-niv-0.2.19-bin/bin/niv matches

According to the "nixpkgs way of doing things", I don't know which reference is legitimate. Would need to dive into the code.

I'm guessing it makes sense for out to propagate bin, but this is just a guess. Looking into bin:

$ cat -v $bin/bin/niv | grep $out
...
^@niv_libdir^@/nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/lib/ghc-8.10.7/aarch64-osx-ghc-8.10.7/niv-0.2.19-3erUdXeYgUx22sPFJG6N5H^@niv_dynlibdir^@/nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/lib/ghc-8.10.7/aarch64-osx-ghc-8.10.7^@niv_datadir^@/nix/store/g6ii9zp8phdi3j3g0bl2vy6mzwdixqak-niv-0.2.19-data/share/ghc-8.10.7/aarch64-osx-ghc-8.10.7/niv-0.2.19^@/^@niv_libexecdir^@/nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/libexec/aarch64-osx-ghc-8.10.7/niv-0.2.19^@niv_sysconfdir^@/nix/store/zss2jbpdw6lf08d6k1b7g0pd833sw0nz-niv-0.2.19/etc

Not sure why all that is being recorded here ...

See the linked issue NixOS/nixpkgs#155722 for a followup ticket regarding the specific error message in op.

Closing this here as it is not a niv issue.