hix
hix copied to clipboard
How to solve "Couldn't find a target code interpreter. Try with -fexternal-interpreter" error when building `.#static`?
I just have a plain project which using string-interpolate relies on TH. Run nix build .#static got the error below, while for my other non-TH projects build static work and output static linked executable.
nix build .#static
error: builder for '/nix/store/nc82swmh4rl9ynxzbx5pb3f7n743srw8-th-orphans-static-x86_64-unknown-linux-musl-0.13.16.drv' failed with exit code 1;
last 25 log lines:
> Using hpc version 0.69 found on system at:
> /nix/store/w6awqpzhn1pmfzql7ba5ar8pvs0yq5s2-ghc-9.8.4/bin/hpc
> Using hsc2hs version 0.68.10 given by user at:
> /nix/store/9ir7bkanq6xq7rnqzr5l62w6wzv044g5-x86_64-unknown-linux-musl-ghc-9.8.4/bin/x86_64-unknown-linux-musl-hsc2hs
> Using hscolour version 1.25 found on system at:
> /nix/store/1ffy1pgaj0ca37fmzzv96vz15mwdf5fb-hscolour-1.25/bin/HsColour
> No jhc found
> Using ld given by user at:
> /nix/store/rpx9lzni95afhrmvchqvjxpkgmq6m8mb-x86_64-unknown-linux-musl-gcc-wrapper-14.3.0/bin/x86_64-unknown-linux-musl-ld
> No pkg-config found
> Using runghc version 9.8.4 found on system at:
> /nix/store/w6awqpzhn1pmfzql7ba5ar8pvs0yq5s2-ghc-9.8.4/bin/runghc
> Using strip version 2.44 given by user at:
> /nix/store/rpx9lzni95afhrmvchqvjxpkgmq6m8mb-x86_64-unknown-linux-musl-gcc-wrapper-14.3.0/bin/x86_64-unknown-linux-musl-strip
> Using tar found on system at:
> /nix/store/8av8pfs7bnyc6hqj764ns4z1fnr9bva1-gnutar-1.35/bin/tar
> No uhc found
> Running phase: buildPhase
> Preprocessing library for th-orphans-0.13.16..
> Building library for th-orphans-0.13.16..
> [1 of 2] Compiling Language.Haskell.TH.Instances.Internal ( src/Language/Haskell/TH/Instances/Internal.hs, dist/build/Language/Haskell/TH/Instances/Internal.o )
> [2 of 2] Compiling Language.Haskell.TH.Instances ( src/Language/Haskell/TH/Instances.hs, dist/build/Language/Haskell/TH/Instances.o )
>
> <no location info>: error:
> Couldn't find a target code interpreter. Try with -fexternal-interpreter
For full logs, run:
nix log /nix/store/nc82swmh4rl9ynxzbx5pb3f7n743srw8-th-orphans-static-x86_64-unknown-linux-musl-0.13.16.drv
error: 1 dependencies of derivation '/nix/store/r583dsxh9rfggphssn71bw6c8gvkaivv-haskell-src-meta-static-x86_64-unknown-linux-musl-0.8.15.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hv2s2326mad24iplcka05ahj4kg7y5yy-string-interpolate-static-x86_64-unknown-linux-musl-0.3.4.0.drv' failed to build
hi @futu2! This is a limitation in nixpkgs currently, see https://github.com/NixOS/nixpkgs/issues/275304 for more information.
The PR https://github.com/NixOS/nixpkgs/pull/383165 claims to implement a workaround, but I couldn't manage to get any of the combinations of pkgsStatic, pkgsMusl and bignum-native to execute splices.
So, we'll have to wait for the time being.