Haskell cabal issue with Mac OS X 10.11? (cannot satisfy -package-id)

时间:2015-10-30 22:40:14

标签: macos haskell osx-elcapitan

I used the latest Haskell Platform 7.10.2-a (https://www.haskell.org/platform/mac.html) on Mac OS X 10.11 for El-capitan.

When I tried to install yesod with cabal install yesod, I have multiple error messages such as:

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...

The error pattern is pretty much the same: cannot satisfy -package-id.

For example, cabal install aeson gives cannot satisfy -package-id attoparse... error.

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

However, attoparsec library seems to be installed without problem.

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.

What might be wrong?

3 个答案:

答案 0 :(得分:3)

根据建议here,您看到的cannot satisfy -package-id错误可能是由于过期缓存造成的。

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

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

答案 1 :(得分:1)

This might be controversial, but imho the haskell platform and cabal (when used directly) are both essentially deprecated now with the advent of stack. Stack will: Automatically install haskell for you (stack setup) Automatically sandbox (and intelligently share sandboxes between projects) Completely avoid cabal hell (in my experience)

答案 2 :(得分:1)

我可以从brew安装yesod。

卸载haskell-plaftorm

  • /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中获得一个包含大部分必要文件的二进制文件。
  • 将二进制文件作为独立服务器执行。
相关问题