Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack does not use system-installed ghc #3096

Closed
s5k6 opened this issue Mar 29, 2017 · 3 comments
Closed

Stack does not use system-installed ghc #3096

s5k6 opened this issue Mar 29, 2017 · 3 comments

Comments

@s5k6
Copy link

s5k6 commented Mar 29, 2017

General summary/comments (optional)

Stack does not use the system-global installed ghc but always tries to
install its own. Even when instructed otherwise.

This looks like a duplicate of #2842, but it is not related to #2852
because ~/.stack/config.yaml contains system-ghc: true.

Steps to reproduce

~$ rm -rf ~/.ghc ~/.cabal ~/.stack

Instruct stack to use globally installed ghc

~$ stack config set system-ghc --global true
/home/sk/.stack/config.yaml has been updated.

Verify:

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

Setup new project

~$ stack new foo
Downloading template "new-template" to create project "foo" in foo/ ...
[...]
Populated index cache.    
* Matches lts-8.6

Selected resolver: lts-8.6
Initialising configuration using resolver: lts-8.6
Total number of user packages considered: 1
Writing configuration to file: foo/stack.yaml
All done.

~$ cd foo
~/foo$ du -sh .
28K     .

Try to compile

~/foo$ stack build

Actual

Error message:

~/foo$ stack build
Compiler version mismatched, found ghc-8.0.1 (x86_64), but expected minor version match with ghc-8.0.2 (x86_64-ncurses6) (based on resolver setting in /home/sk/foo/stack.yaml).
To install the correct GHC into /home/sk/.stack/programs/x86_64-linux/, try running "stack setup" or use the "--install-ghc" flag.

Expected

Compilation without errors, using system-global ghc. I would
have expected the resolver to resolve to something that matches the
system-global ghc.

Stack version

~$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.0.1

~$ stack --version | head -n1
Version 1.4.0 x86_64

~$ cabal --version
cabal-install version 1.24.0.0
compiled using version 1.24.0.0 of the Cabal library 

Method of installation

From the Arch Linux repositories https://www.archlinux.org/.

@MichielDerhaeg
Copy link

MichielDerhaeg commented Mar 29, 2017

I think this happens because your system-ghc is version 8.0.1 and stack resolver lts-8.6 requires 8.0.2.
As far as I know, there is no option to relax this constraint. There is a 'compiler-check: newer-minor' option that allows newer minor versions, but not older ones like in your case. Maybe such option should be added.

@MichielDerhaeg
Copy link

MichielDerhaeg commented Mar 29, 2017

A better solution might be to use the '--resolver ghc-8.0.1' option when calling stack. Then it will use a stackage version that made for your ghc version.

@s5k6
Copy link
Author

s5k6 commented Mar 29, 2017

use the '--resolver ghc-8.0.1' option when calling stack

Yes, that works.

@s5k6 s5k6 closed this as completed Mar 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants