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

Cabal cross-matches versions #2438

Closed
ndmitchell opened this issue Feb 24, 2015 · 9 comments
Closed

Cabal cross-matches versions #2438

ndmitchell opened this issue Feb 24, 2015 · 9 comments

Comments

@ndmitchell
Copy link

On Windows, with the MinGHC install, with cabal --version:

cabal-install version 1.20.0.3
using version 1.20.0.1 of the Cabal library

Picking the ghcid project (just because it was handy), when I do cabal install --verbose I see:

Waiting for install task to finish...
creating dist\setup
"C:\Program Files (x86)\MinGHC-7.8.3\ghc-7.8.3\bin\ghc.exe" "--make" "-odir" ".\dist\setup" "-hidir" ".\dist\setup" "-i" "-i." "-package-id" "Cabal-1.18.1.3-4219b3f170da38844ae813fba0d31349" ".\dist\setup\setup.hs" "-o" ".\dist\setup\setup.exe" "-threaded"
creating C:\Users\ndmit_000\AppData\Roaming\cabal\setup-exe-cache
Installing executable .\dist\setup\setup.exe to
C:\Users\ndmit_000\AppData\Roaming\cabal\setup-exe-cache\setup-Simple-Cabal-1.18.1.3-i386-windows-ghc-7.8.3.exe

So because ghc-pkg list gives Cabal-1.18.1.3, then cabal has decided to pick that. It gets even more confusing when I do:

$ cabal haddock
cabal: You need to re-run the 'configure' command. The version of Cabal being
used has changed (was Cabal-1.18.1.3, now Cabal-1.20.0.1).

So while cabal install compiles a simple setup binary (which seems unnecessary, given its simple style), the haddock doesn't use that simple binary, so you get a version clash. It seems if I then do cabal configure that configures with 1.20, but a cabal install then has to reconfigure it.

In addition, I think because my location of Haddock has a space in it, Cabal-1.18 fails to install the docs but Cabal-1.20 succeeds.

@23Skidoo
Copy link
Member

This happens because of the difference between the internal and external setup methods. Normally for build-type: Simple packages the internal setup method is used, but the parallel install requires using the external setup method. Since you don't have Cabal-1.20.0.1 installed, the setup script is compiled against Cabal-1.18.

One solution is to install the matching version of the Cabal library, or to ship an older version of cabal-install. Haskell Platform does the latter.

@ndmitchell
Copy link
Author

@23Skidoo, that's pretty bad. If @snoyberg and I ship an old version then as soon as someone does cabal update they get a warning message saying they should upgrade. If we ship a newer version then cabal install and cabal configure use different versions. I'd consider that a pretty bad bug in parallel install - why can't parallel install just use the cabal.exe it comes with for internal builds? For example, add an extra (hidden) mode to cabal.exe that does whatever the external setup method does?

@snoyberg
Copy link
Collaborator

I still regularly run into bugs and confusion around this. I don't remember what the last issue was I commented on regarding this problem, but I'd love if this situation was improved.

@23Skidoo
Copy link
Member

as soon as someone does cabal update they get a warning message saying they should upgrade.

This was removed recently.

For example, add an extra (hidden) mode to cabal.exe that does whatever the external setup method does?

That's how I implemented it initially, but @dcoutts thought that the patch was too intrusive. Why can't you ship a new version of Cabal if you are already shipping a new cabal-install? Having two Cabals installed should work fine.

IIRC @ttuegel was looking into making reconfigure happen automatically when the Cabal version has changed (#2214).

@dcoutts
Copy link
Contributor

dcoutts commented Mar 3, 2015

Mmm, the fact that it switches back and forth due to using parallel or not is pretty bad in terms of knock-on consequences. Though having picked an older one ideally we shouldn't then insist on switching back again.

@ndmitchell
Copy link
Author

Installing the newer Cabal and switching back seems undesirable - the old Cabal doesn't work for many of the things I want to do (including generate documentation, as my Haddock is somewhere with a space in it). Wouldn't just having a submode to cabal so that cabal install in parallel uses the compiled version work better? I think the original design by @23Skidoo sounds preferable.

We are aiming to ship a vanilla GHC release with some extra binaries that should have been in the GHC binary all along (e.g. cabal). Upgrading the packages inside GHC isn't feasible, because we are just repackaging.

@ttuegel
Copy link
Member

ttuegel commented Mar 24, 2015

This is a duplicate of #1938.

@dcoutts
Copy link
Contributor

dcoutts commented Jun 1, 2015

I think I must have misunderstood @23Skidoo's approach. I agree it's sensible. @tibbe and I implemented it yesterday, see #2633.

@tibbe
Copy link
Member

tibbe commented Jun 2, 2015

#2633 fixes this:

$ pwd
/tmp/ghcid-0.3.6
$ ghc-pkg list Cabal
/usr/local/lib/ghc-7.10.1/package.conf.d
   Cabal-1.22.2.0
/Users/tibbe/.ghc/x86_64-darwin-7.10.1/package.conf.d
$ ~/src/cabal/cabal-install/dist/build/cabal/cabal --version
cabal-install version 1.23.0.0
using version 1.23.0.0 of the Cabal library
$ ~/src/cabal/cabal-install/dist/build/cabal/cabal install --verbose
...
Ready to install ghcid-0.3.6
Configuring ghcid-0.3.6...
/Users/tibbe/src/cabal/cabal-install/dist/build/cabal/cabal act-as-setup
--build-type=Simple -- configure --verbose=2 --ghc
...
$ ~/src/cabal/cabal-install/dist/build/cabal/cabal haddock
Running Haddock for ghcid-0.3.6...
Preprocessing library ghcid-0.3.6...
...
Documentation created: dist/doc/html/ghcid/index.html
Preprocessing executable 'ghcid' for ghcid-0.3.6...

So as you can see no setup executable is built and cabal just calls itself.

tibbe added a commit that referenced this issue Jun 2, 2015
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.
tibbe added a commit to tibbe/cabal that referenced this issue Jun 2, 2015
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.
tibbe added a commit to tibbe/cabal that referenced this issue Jun 2, 2015
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.
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

6 participants