簡體   English   中英

Cabal Install 解決依賴問題

[英]Cabal Install trouble resolving dependencies

我正在按照本教程嘗試設置 Haskell 項目: http://shuklan.com/haskell/lec10.html#/0/9

我以前用“cabal install”遇到過這個問題。

我收到下面的消息。 我讀到嘗試'rm -rf ~/.ghc ~/.cabal'。 我再次嘗試了“cabal install”以及“cabal new-build”,但我仍然收到相同的消息。

我怎樣才能解決這個問題? 我在 Mac OS X 10.11.4 上。 我可以制作和運行.hs 文件和我們的 ghci。 我從來沒有用其他編程語言創建過“文件結構”或類似的東西,所以我不熟悉所涉及的內容。

謝謝!!


Please switch to using either the new project style and the new-install
command or the legacy v1-install alias as new-style projects will become the
default in the next version of cabal-install. Please file a bug if you cannot
replicate a working v1- use case with the new-style commands.

For more information, see: https://wiki.haskell.org/Cabal/NewBuild

Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: FirstCabalInit-0.1.0.0 (user goal)
[__1] next goal: base (dependency of FirstCabalInit)
[__1] rejecting: base-4.12.0.0/installed-4.1... (conflict: FirstCabalInit =>
base==4.6.*)
[__1] rejecting: base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0,
base-4.10.0.0, base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0,
base-4.8.0.0, base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1,
base-4.6.0.0, base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0,
base-4.3.1.0, base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0,
base-4.1.0.0, base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from
non-upgradeable package requires installed instance)
[__1] fail (backjumping, conflict set: FirstCabalInit, base)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, FirstCabalInit ```

您可以在 Haskell 中找到以下有用的構建工具指南:

根據錯誤消息,您的.cabal文件中似乎有一行

build-depends: base == 4.6.*

這個版本的標准庫base很老了,對應的是GHC-7.6,但是根據報錯信息,你安裝的是GHC-8.6.5。 由於base版本與 GHC 捆綁在一起,因此您不能將base版本用於未安裝的 GHC。 請參閱以下匹配的base和 GHC 版本列表:

看起來您的錯誤可以通過以下修復來解決:

build-depends: base == 4.12.*

對於未來,我可以推薦使用ghcup工具來管理 macOS 上的 GHC 和cabal-install版本:

或者,您可以使用stack構建工具,它在沙盒位置為您管理 GHC 版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM