cabal 沙箱安装仍然失败 "packages are likely to be broken by the reinstalls"

cabal sandbox install still fails with "packages are likely to be broken by the reinstalls"

我正在尝试使用 cabal 沙箱构建 Elm Platform。但是安装失败并显示消息 "packages are likely to be broken by the reinstalls"。在我看来,这似乎与沙盒的整个目的相矛盾,我认为沙盒应该避免这种错误。

任何人都可以为我解释这个错误,甚至更好地帮助我继续 Elm 安装吗?添加 --force-reinstalls 是否安全?

以下是我执行的命令序列:

cabal sandbox init
cabal update
cabal install -j elm-compiler-0.14 elm-package-0.2 elm-make-0.1 elm-reactor-0.2 elm-repl-0.4

我在 Mac OS 10.10 上使用 cabal 1.22.0.0 和 GHC 7.8.2。完整输出如下:

Resolving dependencies...
In order, the following would be installed:
Diff-0.3.0 (new package)
HUnit-1.2.5.2 (new package)
ansi-terminal-0.6.2.1 (new package)
ansi-wl-pprint-0.6.7.1 (new package)
async-2.0.2 (new package)
blaze-markup-0.6.2.0 (new package)
blaze-html-0.7.0.3 (new package)
byteable-0.1.1 (new package)
bytestring-mmap-0.2.2 (new package)
bytestring-trie-0.2.4 (new package)
cereal-0.4.1.1 (new package)
cmdargs-0.10.12 (new package)
concatenative-1.0.1 (new package)
cookie-0.4.1.4 (new package)
cryptohash-0.11.6 (new package)
enumerator-0.4.20 (new package)
attoparsec-enumerator-0.3.3 (new package)
blaze-builder-enumerator-0.2.0.6 (new package)
exceptions-0.6.1 (reinstall) changes: mtl-2.1.3.1 -> 2.2.1,
transformers-0.3.0.0 -> 0.4.1.0
extensible-exceptions-0.1.1.4 (new package)
hfsevents-0.1.5 (new package)
fsnotify-0.1.0.3 (new package)
hourglass-0.2.8 (new package)
asn1-types-0.3.0 (new package)
asn1-encoding-0.9.0 (new package)
asn1-parse-0.9.0 (new package)
crypto-pubkey-types-0.4.2.3 (new package)
http-types-0.8.5 (new package)
mime-types-0.1.0.5 (new package)
monads-tf-0.1.0.2 (reinstall) changes: transformers-0.3.0.0 -> 0.4.1.0
MonadCatchIO-transformers-0.3.1.3 (new package)
network-2.6.0.2 (new version)
parsec-3.1.7 (new version)
indents-0.3.3 (new package)
network-uri-2.6.0.1 (new package)
HTTP-4000.2.19 (new version)
pem-0.2.2 (new package)
prettyclass-1.0.0.0 (new package)
language-glsl-0.1.1 (new package)
publicsuffixlist-0.1 (new package)
regex-base-0.93.2 (new package)
regex-posix-0.95.2 (new package)
securemem-0.1.4 (new package)
crypto-cipher-types-0.0.9 (new package)
cipher-aes-0.2.9 (new package)
cipher-des-0.0.6 (new package)
cipher-rc4-0.1.4 (new package)
crypto-random-0.0.8 (new package)
cprng-aes-0.6.1 (new package)
crypto-numbers-0.2.7 (new package)
crypto-pubkey-0.2.7 (new package)
socks-0.5.4 (new package)
streaming-commons-0.1.8 (new package)
http-client-0.3.8.2 (latest: 0.4.6.2) (new package)
syb-0.4.4 (new package)
tagshare-0.0 (new package)
terminfo-0.4.0.0 (new package)
haskeline-0.7.1.3 (new package)
tf-random-0.5 (new package)
QuickCheck-2.7.6 (new package)
testing-feat-0.4.0.2 (new package)
transformers-compat-0.3.3.4 (new package)
optparse-applicative-0.10.0 (latest: 0.11.0.1) (new package)
union-find-0.2 (new package)
unix-compat-0.4.1.4 (new package)
unordered-containers-0.2.5.1 (new package)
aeson-0.8.0.2 +old-locale (new package)
aeson-pretty-0.7.2 (new package)
uniplate-1.6.12 (new package)
websockets-0.9.2.2 (new version)
wl-pprint-1.1 (new package)
language-ecmascript-0.16.2 (latest: 0.17) (new package)
elm-compiler-0.14 (new package)
x509-1.5.0.1 (new package)
x509-store-1.5.0 (new package)
x509-system-1.5.0 (new package)
x509-validation-1.5.1 (new package)
tls-1.2.13 (new package)
connection-0.2.3 (new package)
http-client-tls-0.2.2 (new package)
zip-archive-0.2.3.5 (new version)
elm-package-0.2 (latest: 0.2.2) (new package)
elm-make-0.1 (new package)
elm-repl-0.4 (new package)
zlib-enum-0.2.3.1 (new package)
snap-core-0.9.6.4 (new package)
snap-server-0.9.4.6 (new package)
websockets-snap-0.9.0.0 (new package)
elm-reactor-0.2 (latest: 0.2.0.1) (new package)
cabal: The following packages are likely to be broken by the reinstalls:
temporary-1.2.0.3
shellmate-0.1.6
Use --force-reinstalls if you want to install anyway.

更新:

根据要求,cabal exec ghc-pkg list temporary 的输出:

$ cabal exec ghc-pkg list temporary
/Applications/ghc-7.8.2.app/Contents/lib/ghc-7.8.2/package.conf.d
   temporary-1.2.0.3
/Users/nbartlett/Development/Elm-Platform/tmp/.cabal-sandbox/x86_64-osx-ghc-7.8.2-packages.conf.d

您已将 shellmatetemporary(可能还有一些其他包 -- 特别是它们的依赖项)安装到您的全局包数据库中,这在沙箱中也是可见的。错误是说:

  1. 您将要安装一个已安装的软件包(称为 A-1)的新版本(称为 A-2),并且
  2. 您将要重新安装一个软件包的现有版本(称为 B),该版本将其依赖项之一从 A-1 更新为 A-2,并且
  3. 新的B会影响旧的B,并且
  4. 有一个包(称之为 C)依赖于 B。

所有这一切的结果是,C 可能会在重新安装 B 后被破坏,因为它将 link 到 B 期望它拖入 A-1,但 A-2 将被吸毒反而。在您的特定情况下,shellmatetemporary 都在扮演 C 的角色,并且对于他们每个人来说,至少 exceptions-0.6.1monads-tf-0.1.0.2 中的一个在扮演 B.

你有很多选择;最吸引我的是:

  1. 从全局包数据库中删除 shellmatetemporary。这些以后就不用了,但是这样肯定能避免很多问题。

    ghc-pkg unregister --global shellmate
    ghc-pkg unregister --global temporary
    
  2. 使用更新的依赖项在全局包数据库中重新安装 shellmatetemporary。这可能有效也可能无效。

    cabal install --reinstall --global shellmate-0.1.6 temporary-1.2.0.3 mtl-2.2.1 transformers-0.4.1.0
    
  3. 忽略警告并强制重新安装。 shellmatetemporary 可能无法在沙箱中使用。

    cabal install elm --force-reinstalls # from within the sandbox
    
  4. 将 elm、shellmate 和 temporary 都安装到沙箱中。这可能仍然会给您警告,但可以安全地忽略它们:在沙箱内,您希望使用沙箱版本(因此 "broken" 全局包无关紧要),而在沙箱外全局包不会坏。

    cabal install elm temporary shellmate # possibly with --force-reinstalls
    

我在尝试同时安装多个软件包时遇到了同样的问题。一个包 A 依赖于包 B,A 和 B 依赖于包 C 的不同版本。(无论如何,这就是我对这种情况的心理模型)。

通过单独安装软件包而不是一次全部安装,我的特定安装障碍已被清除 [*]。我一次用一个包执行 N 个命令,而不是一个命令包含 N 个包。

[*] 由于我不确定我的问题的原因,我也不能确定到底是什么解决了它。