Linker error on aarch64-linux

How may I debug this:

@nix { “action”: “setPhase”, “phase”: “setupCompilerEnvironmentPhase” }
setupCompilerEnvironmentPhase
Build with /nix/store/qq4fwk90y399lv5vk8s85pq7w4qm7gxn-ghc-8.10.4.
@nix { “action”: “setPhase”, “phase”: “unpackPhase” }
unpacking sources
unpacking source archive /nix/store/l2yx3xkpxwhqnf79j0xi3xchx6da4sny-mmhaskell-1
source root is mmhaskell-1
@nix { “action”: “setPhase”, “phase”: “patchPhase” }
patching sources
@nix { “action”: “setPhase”, “phase”: “compileBuildDriverPhase” }
compileBuildDriverPhase
setupCompileFlags: -package-db=/data/data/com.termux.nix/files/usr/tmp/nix-build-mmhaskell1-0.1.0.0.drv-0/setup-package.conf.d -j8 +RTS -A64M -RTS -threaded -rtsopts
[1 of 1] Compiling Main ( /nix/store/4mdp8nhyfddh7bllbi7xszz7k9955n79-Setup.hs, /data/data/com.termux.nix/files/usr/tmp/nix-build-mmhaskell1-0.1.0.0.drv-0/Main.o )
Linking Setup …
/nix/store/v1lm17fqfzq1y3vyc42cc9kwcjh7qkjp-binutils-2.35.1/bin/ld.gold: error: /lib: can not read directory: Permission denied
collect2: error: ld returned 1 exit status
cc' failed in phase Linker’. (Exit code: 1)

It is on an aarch64-linux system:

  • 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: /nix/store/lqhxl0qnqazm4ddnsbis2jvf4vfnsdva-2eb7828b36e73477aac179ca58a26c9170e86d03.tar.gz

Watch progress eventually or just to reproduce what is being said by op here: https://github.com/573/aarch64-linux-ld-issue155722-reproduce, currently blocked by aarch64-linux: hLock: invalid argument (Invalid argument) · Issue #7950 · haskell/cabal · GitHub