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

Compiler version mismatch after stack init / stack build #2673

Closed
simonmar opened this issue Oct 5, 2016 · 4 comments
Closed

Compiler version mismatch after stack init / stack build #2673

simonmar opened this issue Oct 5, 2016 · 4 comments
Milestone

Comments

@simonmar
Copy link

simonmar commented Oct 5, 2016

It looks like stack init picked up that I had ghc-8.0.1 installed, but then stack build got confused:

~/code/Haxl > ~/.local/bin/stack init
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- haxl.cabal
- example/facebook/haxl-facebook.cabal
- example/sql/haxl-example.cabal

Selecting the best among 9 snapshots...

Populated index cache.    
* Matches lts-7.2

Selected resolver: lts-7.2
Initialising configuration using resolver: lts-7.2
Total number of user packages considered: 3
Writing configuration to file: stack.yaml
All done.
~/code/Haxl > ~/.local/bin/stack build
Compiler version mismatched, found ghc-7.10.3 (x86_64), but expected minor version match with ghc-8.0.1 (x86_64) (based on resolver setting in /home/smarlow/code/Haxl/stack.yaml).
Try running "stack setup" to install the correct GHC into /home/smarlow/.stack/programs/x86_64-linux/
@tolysz
Copy link
Collaborator

tolysz commented Oct 5, 2016

Looks like there is no global ghc matching ghc-8.0 prefix.
The easiest is to
~/.local/bin/stack build --install-ghc
Which will install ghc at the compatible version if is missing. It was decided that installing ghc without asking was not desired

@sjakobi
Copy link
Member

sjakobi commented Oct 5, 2016

It looks like stack init picked up that I had ghc-8.0.1 installed

No, AFAIK, stack init does not check which compilers are locally available.

@sjakobi
Copy link
Member

sjakobi commented Oct 5, 2016

It sounds like you have both ghc-7.10.3 and ghc-8.0.1 installed, but the ghc executable with version 7.10.3 comes first on your PATH.

To make stack pick up your system-installed ghc-8.0.1, I think there's currently no better way than to modify your PATH so ghc-8.0.1 comes first.

We want to improve stack's handling of multiple system ghc installations but I can't find the relevant issue right now.

@sjakobi sjakobi added this to the Support milestone Oct 5, 2016
@simonmar
Copy link
Author

simonmar commented Oct 5, 2016

Oh, this is my confusion then. stack init just chose the most recent valid install plan, but it's my responsibility to ensure that I've installed a matching ghc and put it first on the PATH. When #2433 is done this will be easier, so I'll just wait for that.

Thanks for the quick response!

@simonmar simonmar closed this as completed Oct 5, 2016
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

3 participants