-
Notifications
You must be signed in to change notification settings - Fork 841
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
Find system ghc via binary names like "ghc-7.10.3"? #2433
Comments
I think calling I admit I'm fuzzy on what exactly you have in mind (see below). Interpreting rather liberally, I imagine a few parts to this:
On the rest, I'm confused (which is why I didn't answer a week ago). Could you elaborate? I'm less sure about the changes you propose to the version check, probably because I didn't finish reverse-engineering how it works. In particular, we often don't even call
I'm more confused by the link with #2221. Doesn't the version check only make sense for the system GHC? And then that could be dropped by using |
It works less well for ghcjs right now, because there are a lot of different tarballs all with version
Good point, I haven't looked deeply at those details. Could be we can't avoid that. We could cache it?
Not sure, I think because it's a mild sanity check, shouldn't be needed though.
If we don't change the default then we'll always have to check the system ghc version. |
I think that even if you change the default you'll need some check. OTOH, I understand all GHC bindists also provide binaries named
|
True!
Yeah, maybe we can just go ahead and always trust it for |
@mgsloan how would this work for the various tools installed with GHC, do they all get suffixed? Some builds are going to fail if not using the associated tool matched to the GHC version. |
Thanks for pointing that out! We should surely use the same version for any invocation of
|
That is indeed a good point! That makes this a bit trickier, but still a good change I hope. |
@mgsloan @Blaisorblade not to derail the intent of the thread, but wouldn't inter-operability with tools expecting ordinary names for these utilities be better served by doing the paths like @hvr's GHC distributions? It puts the version in a subdirectory of a consistent path ( This is roughly what |
@bitemyapp Certainly! However, that does not work with standard global installations of GHC. Are they so tied to happy / alex versions? Stack implements its own approach for switching sub-directories, which is why we haven't had logic like this. |
Not certain what you mean. Users of hvr's PPA usually just pick a version and get on with it.
I've seen incompatible haddock binaries break builds. I am very impatient with unnecessary build breakage. |
It seems that some users, such as @simonmar do a global install rather than that approach. Their usecase is quite valid, though indeed it may open a can of worms, I'm not certain.
Agreed. You will be entirely safe from this if you have the appropriate GHC installed by stack. I'd recommend not even having a global GHC install. We are definitely planning to make global GHC a non-default thing in the next release - #2537 |
You mean putting it somewhere everything can find it? Yeah, I do that with hvr's thing via symlinks. I used to even have a script I would pass the path of the install to, and then it would symlink into /usr/bin for me.
Having bumped into
Very much looking forward to it 👍 :) |
Great! Note that you can already adopt this default by just putting |
So, @bitemyapp , are you saying that |
No, nothing's wrong, I'm saying I set that configuration quite awhile ago and I think I was one of the earlier people agitating for making just happy it's getting fixed :) |
Can we have an option to tell Stack the path of the GHC binary and have Stack call |
Yes, it is easy to implement @simonmar , just an oversight due to our typical usecases using official GHC versions. No promises, but we are planning to get it into the next release, likely a couple weeks from now if not sooner. |
@simonmar I've looked into implementing an option like that. It'd actually be a bit tricky to support - lets say the user provides Another approach I've considered is a Perhaps in the meantime it's sufficient to just extend the PATH? If any renaming needs to be done (e.g. ghc-stage2), symbolic links could be used. |
@mgsloan Note that |
I use ghcup now. |
@mgsloan — is this still relevant? And if so, what would be needed to resolve the issue? |
Yes, I believe it is still relevant. It's too bad that it didn't get resolved previously. I think there's two things:
I have been doing a bit of work on GHC lately, so it's on my todo list to make it easier to use stack with a dev version of GHC. Of course, I encourage anyone else to work on that. Not sure when I'd get around to it. |
If you enable system-ghc, and have multiple versions of GHC available, Stack will now find the appropriate one based on the version-suffixed name. Note: the code in Stack.Setup is _really_ difficult to follow at this point. This PR makes the situation a bit worse, to avoid making this diff larger than it has to be. A later PR to clean up Stack.Setup would be a great idea.
If you enable system-ghc, and have multiple versions of GHC available, Stack will now find the appropriate one based on the version-suffixed name. Note: the code in Stack.Setup is _really_ difficult to follow at this point. This PR makes the situation a bit worse, to avoid making this diff larger than it has to be. A later PR to clean up Stack.Setup would be a great idea.
I've opened up #4668 which addresses this. I've included an integration test and tested it manually on my machine, but it would be great if someone who has the use case described here could test out that PR. |
I'm honestly not following the use case for option 1. If you want to manually state which GHC to use on each invocation, you can call Stack with Maybe I'm missing something fundamental here. |
@snoyberg Well, @ygale objected elsewhere to modifying PATH, but their arguments mystify me. |
Thanks for clarifying @Blaisorblade! |
Find GHC on PATH via version suffixes (fixes #2433)
Just to note, I think I also asked for option (1) a while ago to support using stack to test locally-built versions of GHC. As far as I'm aware that's not possible right now. |
* Use ghc-8.2.2 for init * Only require GHC 8.2.2 for the #2433 integration test * More reliable bad-bounds test using local file * Skip building for no init * Skip a test on Windows (fails due to bounds issues)
In #2221, we're planning to switch away from using system ghc by default. We could consider trusting that the correct version is installed and skipping the version check.
It turns out that for non system ghcs it is also potentially possible to skip the version check. Someone on IRC mentioned that binaries named things like
ghc-7.10.3
exist, and that stack should use these. Skipping the check should save a bit of execution time, potentially something like a tenth of a second.This would mean not gracefully handling cases like #2430 . One option would be to perform such sanity checks after a failing build, if the Cabal errors for these cases are insufficient. This way, the user gets feedback quickly. For failing builds, it will wait a bit longer before exiting, to run the sanity checks.
The text was updated successfully, but these errors were encountered: