簡體   English   中英

Stack 一直使用錯誤的 GHC 版本

[英]Stack keeps using wrong GHC version

我已經在我的(Debian 9)系統上安裝了ghc 8.6.5 版本,這是唯一可用的版本(查看下面的詳細信息)。 我正在嘗試構建這個項目: https : //github.com/deech/fltkhs-themes-demo

所以我安裝了最新的堆棧( Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2 )並嘗試編譯項目:

git clone git@github.com:deech/fltkhs-themes-demo.git
cd fltkhs-themes-demo/
stack build --flag fltkhs:bundled

我最初得到的是這樣的:

Stack has not been tested with GHC versions above 8.6, and using 8.8.2, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
asset-bundle      > configure

現在,我已將~/.stack/config.yaml為系統 ghc:

% stack config set system-ghc --global true
/home/mark/.stack/config.yaml has been updated.

設置似乎是正確的:

% cat ~/.stack/config.yaml
templates:
  params: null
system-ghc: true

那么為什么 stack 使用 ghc 8.8.2 呢?

這更加奇怪,因為該項目似乎在其stack.yaml使用了指定的 ghc 版本:

cat fltkhs-themes-demo/stack.yaml
resolver: lts-15.0
allow-newer: true
extra-deps:
- fltkhs-0.8.0.3
- fltkhs-themes-0.2.0.3
- load-font-0.1.0.3
- asset-bundle-0.1.0.1

如何讓它使用 ghc 8.6.5?

有關我的系統的更多詳細信息:

user@system ~ % ls -1 .ghcup/bin
cabal
ghc
ghc-8.6
ghc-8.6.5
ghci
ghci-8.6
ghci-8.6.5
ghc-pkg
ghc-pkg-8.6
ghc-pkg-8.6.5
ghcup
haddock
haddock-8.6
haddock-8.6.5
haddock-ghc
haddock-ghc-8.6
haddock-ghc-8.6.5
hp2ps
hp2ps-8.6
hp2ps-8.6.5
hpc
hpc-8.6
hpc-8.6.5
hsc2hs
hsc2hs-8.6
hsc2hs-8.6.5
runghc
runghc-8.6
runghc-8.6.5
runhaskell
runhaskell-8.6
runhaskell-8.6.5

user@system ~ % cabal --version
cabal-install version 3.0.0.0
compiled using version 3.0.0.0 of the Cabal library 

user@system ~ % ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5

user@system ~ % which ghc
/home/user/.ghcup/bin/ghc

每個 Stackage 解析器都綁定到特定的 GHC 版本。 既然如此,如果您選擇的解析器使用的 GHC 版本與您在系統范圍內安裝的版本不同,則無論system-ghc選項如何,Stack 都會安裝它。 正如Stack FAQ 所說

請注意,stack 只能使用系統 GHC 安裝,前提是其版本與當前項目的配置兼容,尤其是解析器設置。

在您的情況下, lts-15.0使用 GHC 8.8.2,如其 Stackage 頁面所示 如果您想使用系統的 8.6.5,您可以將解析器切換到lts-14.27這是目前使用 8.6.5 的最新 LTS

暫無
暫無

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

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