packunused icon indicating copy to clipboard operation
packunused copied to clipboard

Cabal version differences

Open ndmitchell opened this issue 11 years ago • 3 comments

Seems that if I have a cabal.exe compiled with a newer Cabal than I have installed then it doesn't work. Not sure if there is any way round that? Running runhaskell Setup configure seems to get further, but not to the end.

C:\Neil\neil>cabal configure
Resolving dependencies...
Configuring neil-0.0...

C:\Neil\neil>packunused
packunused: user error (You need to re-run the 'configure' command. The version
of Cabal being used has changed (was Cabal-1.20.0.0, now Cabal-1.16.0).)

C:\Neil\neil>cabal --version
cabal-install version 1.20.0.1
using version 1.20.0.0 of the Cabal library

C:\Neil\neil>ghc-pkg list | grep Cabal
    Cabal-1.16.0

ndmitchell avatar Jun 16 '14 21:06 ndmitchell

Yeah, this is a pretty pervasive problem. I've seen it in a number of places. I worked around it here as follows:

cabal get packunused
cd packunused-0.1.1.2
cabal sandbox init
cabal --version
cabal install --constraint='Cabal==1.20.0.1'

...where 1.20.0.1 is whatever Cabal version you saw in the "cabal --version" output.

mightybyte avatar Nov 21 '14 20:11 mightybyte

This also happens with stack.

$ packunused
packunused: Error: Saved package config file is outdated:
 the Cabal version changed from Cabal-2.2.0.1 to Cabal-1.24.2.0
 the compiler changed from ghc-8.4 to ghc-8.0
Re-run the 'configure' command.

You can probably fix this by running:
  stack setup --upgrade-cabal
CallStack (from HasCallStack):
  error, called at packunused.hs:115:26 in main:Main
$ stack setup --upgrade-cabal
Manipulating the global Cabal is only for debugging purposes
No upgrade necessary: Cabal-2.2.0.1 is the same or newer than latest hackage version 2.2.0.1
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec

alexanderkjeldaas avatar May 30 '18 13:05 alexanderkjeldaas

ok, so the problem is likely that since packunused didn't compile with the latest stackage version, I compiled it using the latest working resolver, which was lts-9.21.

A fix for this would be to update the docs to say:

For stack:  stack clean
            stack build --ghc-options=-ddump-minimal-imports
            stack install packunused <<<---- ADD THIS LINE
            packunused

which ensures that packunused is built using the same resolver as the rest of the code.

alexanderkjeldaas avatar May 30 '18 13:05 alexanderkjeldaas