stack fails to build a project if resolver ghc version is installed but no set as default
Hi, given
- os windows 10
- stack, ghc-8.8.4 and ghc-8.10.5 installed by ghcup
- this global stack config:
local-programs-path: D:/bin/stack
local-bin-path: D:/bin
templates:
params: null
system-ghc: true
- this powershell session
> stack init stack-example ; cd stack-example ; echo "resolver: lts-16.31" > stack.yaml
> ghcup set ghc 8.10.5
> stack build
Building all executables for `stack-example' once. After a successful build of all of them, only specified executables will be rebuilt.
stack-example> configure (lib + exe)
Configuring stack-example-0.1.0.0...
Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.4.exe: The following package
dependencies were requested
--dependency='base=base-4.13.0.0'
however the given installed package instance does not exist.
-- While building package stack-example-0.1.0.0 (scroll up to its section to see the error) using:
D:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_3.0.1.0_ghc-8.8.4.exe --builddir=.stack-work\dist\29cc6475 configure --user --package-db=clear --package-db=global --package-db=D:\sr\snapshots\cce4c425\pkgdb --package-db=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\pkgdb --libdir=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\lib --bindir=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\bin --datadir=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\share --libexecdir=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\libexec --sysconfdir=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\etc --docdir=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\doc\stack-example-0.1.0.0 --htmldir=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\doc\stack-example-0.1.0.0 --haddockdir=D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\doc\stack-example-0.1.0.0 --dependency=base=base-4.13.0.0 --extra-include-dirs=D:\bin\stack\x86_64-windows\msys2-20210604\mingw64\include --extra-lib-dirs=D:\bin\stack\x86_64-windows\msys2-20210604\mingw64\lib --extra-lib-dirs=D:\bin\stack\x86_64-windows\msys2-20210604\mingw64\bin --exact-configuration --ghc-option=-fhide-source-paths
Process exited with code: ExitFailure 1
> ghcup set ghc 8.8.4
[ Warn ] New GHC version available: 9.0.1. To upgrade, run 'ghcup install ghc 9.0.1'
[ Info ] GHC 8.8.4 successfully set as default version
PS D:\dev\ws\haskell\issues\stack-example> stack build
Building all executables for `stack-example' once. After a successful build of all of them, only specified executables will be rebuilt.
stack-example> configure (lib + exe)
Configuring stack-example-0.1.0.0...
stack-example> build (lib + exe)
Preprocessing library for stack-example-0.1.0.0..
Building library for stack-example-0.1.0.0..
[1 of 2] Compiling Lib
[2 of 2] Compiling Paths_stack_example
Preprocessing executable 'stack-example-exe' for stack-example-0.1.0.0..
Building executable 'stack-example-exe' for stack-example-0.1.0.0..
[1 of 2] Compiling Main
[2 of 2] Compiling Paths_stack_example
Linking .stack-work\dist\29cc6475\build\stack-example-exe\stack-example-exe.exe ...
Installing library in D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\lib\x86_64-windows-ghc-8.8.4\stack-example-0.1.0.0-8GQicyfpaEBrZcPe0Yx4m
Installing executable stack-example-exe in D:\dev\ws\haskell\issues\stack-example\.stack-work\install\4d3a3a3f\bin
Registering library for stack-example-0.1.0.0..
- Adding
compiler: ghc-8.8.4
does not help
Edited by Javier Neira