Stack 尝试查找 libgmp 然后失败,即使根本没有依赖项

问题描述 投票:0回答:1

我使用 nix-darwin 并在

~/.stack/config.yaml
中启用了 nix。 今天早些时候,我做了一个
sudo nix-collect-garbage -d
,然后很多事情开始崩溃。

最小可重现示例:

stack new mwe
cd mwe
stack build
mwe> configure (lib + exe)
dyld[39413]: Library not loaded: /nix/store/lac8fhiz0pmif1bmrkkry3w4slc9wg47-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib
  Referenced from: <0F2264AA-4505-36E1-A379-2BC393A601C5> /Users/futar/.stack/setup-exe-cache/aarch64-osx-nix/Cabal-simple_CKvAmRb3_3.10.3.0_ghc-9.6.6
  Reason: tried: '/nix/store/lac8fhiz0pmif1bmrkkry3w4slc9wg47-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/nix/store/lac8fhiz0pmif1bmrkkry3w4slc9wg47-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib' (no such file), '/nix/store/lac8fhiz0pmif1bmrkkry3w4slc9wg47-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib' (no such file), '/usr/local/lib/libgmp.10.dylib' (no such file), '/usr/lib/libgmp.10.dylib' (no such file, not in dyld cache)

Error: [S-7282]
       Stack failed to execute the build plan.

       While executing the build plan, Stack encountered the error:

       [S-7011]
       While building package mwe-0.1.0.0 (scroll up to its section to see the error) using:
       ...
       Process exited with code: ExitFailure (-6)

这是我在这次垃圾回收之前从未见过的问题。

gmp
中添加
stack.yaml
作为 nix 包没有帮助,并且会导致相同的错误消息。也不会
nix-shell -p gmp

nix:
  enable: true
  packages:
    - gmp

我这里有

gmp-with-cxx
。为什么堆栈找不到它? 为什么使用了错误的哈希值?

% ls /nix/store/*-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib
/nix/store/lm1rva8c2649y4lys3d406s9ldicv8qv-gmp-with-cxx-6.3.0/lib/libgmp.10.dylib
haskell haskell-stack gmp nix nix-darwin
1个回答
0
投票

删除

~/.stack/setup-exe-cache
stack clean --full
,然后
stack build
即可工作。不确定我是否每次都必须这样做
nix-collect-garbage

© www.soinside.com 2019 - 2024. All rights reserved.