0

I have installed version 8.6.5 of ghc on my (Debian 9) system and that's the only version available (look below for the details). I'm trying to build this project: https://github.com/deech/fltkhs-themes-demo

So I've installed latest stack (Version 2.1.3, Git revision 636e3a759d51127df2b62f90772def126cdf6d1f (7735 commits) x86_64 hpack-0.31.2) and try to compile the project:

git clone [email protected]:deech/fltkhs-themes-demo.git
cd fltkhs-themes-demo/
stack build --flag fltkhs:bundled

What I initially get is this:

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

Now, I have set ~/.stack/config.yaml to system ghc:

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

Settings appear to be correct:

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

So why is stack using ghc 8.8.2?

This is all the more bizarre because the project seems to use specified ghc version in its stack.yaml:

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

How do I make it use ghc 8.6.5?

More details about my system:

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
4
  • 4
    You may try resolver: lts-14.2 in stack.yaml. Then it will download the appropriate GHC version for that LTS as well and i think it will be 8.6.5 Commented Mar 5, 2020 at 15:33
  • 3
    Indeed the crucial line is resolver: lts-15.0. LTS 15.0 uses GHC 8.8.2. Commented Mar 5, 2020 at 15:44
  • If you turn this into an answer and add some more details, I'll accept it. Commented Mar 5, 2020 at 16:52
  • Closely related: Haskell Stack doesn't use system Ghc (my answer here is mostly for the sake of adding updated links). Commented Mar 5, 2020 at 21:53

1 Answer 1

1

Each Stackage resolver is tied to a specific GHC version. That being so, if you pick a resolver that uses a GHC version different from the one you have installed system-wide, Stack will install it regardless of the system-ghc option. As the Stack FAQ puts it

Note that stack can only use a system GHC installation if its version is compatible with the configuration of the current project, particularly the resolver setting.

In your case, lts-15.0 uses GHC 8.8.2, as can be seen on its Stackage page. If you want to use your system's 8.6.5, you can switch the resolver to lts-14.27, which at the moment is the most recent LTS that uses 8.6.5.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.