【问题标题】:Haskell cabal issue with Mac OS X 10.11? (cannot satisfy -package-id)Mac OS X 10.11 的 Haskell 阴谋集团问题? (不能满足-package-id)
【发布时间】:2015-10-30 22:40:13
【问题描述】:

我在 Mac OS X 10.11 上为 El-capitan 使用了最新的 Haskell Platform 7.10.2-a (https://www.haskell.org/platform/mac.html)。

当我尝试使用cabal install yesod 安装yesod 时,出现多个错误消息,例如:

Building email-validate-2.1.3...
Building http-api-data-0.2.1...
Building fast-logger-2.4.1...
Building http-date-0.0.6.1...
Failed to install crypto-random-0.0.9
Build log ( /Users/smcho/.cabal/logs/crypto-random-0.0.9.log ):
Configuring crypto-random-0.0.9...
Building crypto-random-0.0.9...
Preprocessing library crypto-random-0.0.9...
<command line>: cannot satisfy -package-id vector-0.11.0.0-730f99979d41c11c3a1ef069844b5f57
    (use -v for more information)
Failed to install email-validate-2.1.3
Build log ( /Users/smcho/.cabal/logs/email-validate-2.1.3.log ):
Configuring email-validate-2.1.3...

错误模式几乎相同:cannot satisfy -package-id

例如,cabal install aeson 给出cannot satisfy -package-id attoparse... 错误。

Resolving dependencies...
Configuring aeson-0.10.0.0...
Building aeson-0.10.0.0...
Failed to install aeson-0.10.0.0
Build log ( /Users/smcho/.cabal/logs/aeson-0.10.0.0.log ):
Configuring aeson-0.10.0.0...
Building aeson-0.10.0.0...
Preprocessing library aeson-0.10.0.0...
<command line>: cannot satisfy -package-id attoparsec-0.13.0.1-99b4df28644e63383f308c810764a8bb
    (use -v for more information)
cabal: Error: some packages failed to install:
aeson-0.10.0.0 failed during the building phase. The exception was:
ExitFailure 1

但是, attoparsec 库似乎安装没有问题。

smcho@macho ~> cabal install attoparsec
Resolving dependencies...
All the requested packages are already installed:
attoparsec-0.13.0.1
Use --reinstall if you want to reinstall anyway.

可能出了什么问题?

【问题讨论】:

  • 我建议两件事:a) 放弃 haskell 平台并通过brew 安装。 b)使用堆栈(年龄)。

标签: macos haskell osx-elcapitan


【解决方案1】:

正如here 建议的那样,您看到的cannot satisfy -package-id 错误可能是由于缓存过期。

如果运行 ghc-pkg check 警告您缓存已过期,则运行 ghc-pkg recache 可能会解决您的问题。

我整个早上都在遇到cannot satisfy -package-id 问题(不是yesod,而是其他各种包)。 ghc-pkg recache 解决了我的问题。希望这会有所帮助。

【讨论】:

    【解决方案2】:

    这可能会引起争议,但恕我直言,随着 stack 的出现,haskell 平台和 cabal(直接使用时)现在基本上都已弃用。

    堆栈将:

    1. 自动为你安装 haskell (stack setup)
    2. 自动沙箱(并在项目之间智能共享沙箱)
    3. 完全避免阴谋集团的地狱(根据我的经验)

    【讨论】:

      【解决方案3】:

      我可以从 brew 安装 yesod。

      卸载 haskell-plastorm

      • /Library/Haskell/bin/uninstall-hs thru 7.10.2

      安装 ghc

      • brew install ghc
        • brew link ghc

      安装堆栈

      • brew install haskell-stack

      安装Yesod

      • stack install yesod
      • stack install yesod-bin

      使用Yesod

      使用 Yesod 进行开发

      • 我不确定,但我必须先运行stack exec yesod build
      • stack exec yesod devel

      使用 keter 部署 Yesod

      • 删除 config/keter.yaml 中的第一行
      • stack exec yesod keter,您将在 dist/bin 中获得一个二进制文件,其中包含运行所需的大部分文件。
      • 将二进制文件作为独立服务器执行。

      【讨论】:

      • 您在回答中将 Stackage 与 Stack 混为一谈。它们是不同但相关的东西。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-04
      相关资源
      最近更新 更多