-
Notifications
You must be signed in to change notification settings - Fork 697
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
cabal install; cabal test switches Cabal/GHC versions #1938
Comments
I had the same problem https://travis-ci.org/MaxGabriel/hackvote-yesod/builds/29276486 |
I think this is related to #1953; |
The cause of the version switch is that the commands "configure", "build", and "test" all attempt to use the version of Cabal with which cabal-install was built, whereas the "install" command tries to use the version of Cabal which is currently installed. Sandboxes are still indirectly involved in the problem: whereas before, cabal-install was likely to be installed to So why isn't cabal-install always using the version of Cabal with which it was built? The reason is explained in the documentation for
While I'm not sure why only "install" would need to compile and execute the external |
With the |
Thanks for the quick response! When you say that "with the
|
Further exploration reveals that the "external build method", which uses the installed version of Cabal, is explicitly forced whenever cabal-install runs more than one job in parallel (
Any idea why parallel builds force this external mode? |
@gelisam Parallel builds happen in separate processes, not just separate threads, so I suspect that cabal-install is running the build through one of its cached Setup executables. I don't know why it is picking a different version. At least, we should be consistent with respect to in-tree builds about the version chosen. |
The closed ticket #2438 details exactly why this happens. |
@gelisam Do you have |
Thanks Neil! I had skimmed that ticket, but its contents didn't make as much sense then as it does now. @ttuegel Neither of them are "installed" in the sense in which I've been using the word above. I have installed cabal-install-1.23 and Cabal-1.23.0.0 in a separate sandbox, so when I run cabal-install on my hello world project, the only version of Cabal it sees installed is the one which comes with ghc 7.10. |
Cabal uses |
So, let's recap. The "install" command uses parallel builds, which in turn causes cabal-install to use the external setup method, which causes cabal-install to generate the source for a file called Okay, so what is this generated Looking at the source of the generated |
We cannot link The in-tree commands are run in the cabal-install process whenever possible, i.e. when |
My primary goal for running commands through cabal-install is correctness. I am on a GHC which ships with a Cabal that can't tolerate spaces in the path of the Haddock binary. A Cabal bug, long since fixed. However, even though I am using a newer cabal-install, I still get a very old bug. |
Hmm, this discussion about My
Now, my package is a bit unusual in that it needs to be installed before being tested, so the typical build/test/install sequence doesn't work for me. For this reason, I have used
Note that unlike what happens with #2214, running So the error message I see is the same as the first message of this thread, but it seems everybody else on this thread managed to experience this with |
I just learned that cabal-install-1.22 installs a private copy of Cabal-1.22. I immediately came here hoping that it was a new feature which was added in order to fix this bug, but no, I see that we have been talking about Cabal-1.23, which must already have had this feature. So why aren't the setup files linked against that private copy? It should be the same version as the one the cabal-install executable is linked with, so all the commands should be able to use the same Cabal version. |
@gelisam cabal-install-1.22 does not install a private copy of Cabal-1.22. |
Ah, I see, so cabal-helper-wrapper is not some internal cabal helper, it's some external tool which uses cabal. Sorry for the noise then. |
The previous failures were due to this bug: haskell/cabal#1938
Ok, so here's my analysis... It's not that install "tries" to use a version of Cabal that's installed, but that when doing parallel builds we (currently) have to use multiple processes for the Now when it comes to build or test or whatever, we were then not in the situation where we had to force the use of the external setup method due to the multi-process issue, and so it was able to use the "internal setup method". The problem with this was twofold:
However, now we have another fix (#2633) which allows us to use the
Is this going to be stable? The build type and required cabal version are external info, coming from .cabal files and the command line. Those do switch between the external and self & internal methods, but that info itself can be considered stable. The logging and force-external conditions are internally generated choices but now these only switch between the self and internal setup methods, which are consistent with each other. So I think I've convinced myself that this means it's stable overall. Which means I think this should be a full fix for the problem. The other issue was about the test command not looking at the sandbox environment, which is fixed now right @ttuegel? |
This is fixed by #2633:
|
This fixes issues when the version of Cabal that cabal-install was built against differs from the one registered in the local package DB. Normally we compile an external setup against the local Cabal library, which could lead to failures or inconsistent results compared to using the internal method. This fixes #2438 and fixes #1938.
This fixes issues when the version of Cabal that cabal-install was built against differs from the one registered in the local package DB. Normally we compile an external setup against the local Cabal library, which could lead to failures or inconsistent results compared to using the internal method. This fixes haskell#2438 and fixes haskell#1938.
Awesome, thanks! |
The previous failures were due to this bug: haskell/cabal#1938
Fix suggested by haskell/cabal#1938
Here's a reproduction from travis: https://travis-ci.org/silkapp/json-schema/builds/27422735 (updated to a commit with a smaller diff)
The error is:
This is the diff between this commit and one that builds correctly:
So
cabal install --only-dependencies
seems to not run into this problem.I haven't been able to reproduce this locally, but @gilligan had the same problem when using
codex
.@kosmikus also mentioned that he had seen this before.
The text was updated successfully, but these errors were encountered: