user855443
user855443

Reputation: 2950

stack 1.6.5 not working with cabal 2.0.0.1

I have stack 1.6.5 but see the error described in Cabal 2.0 required when using a nightly snapshot with stack. I understand that the problem was solved in stack v 1.5.1, but I see it in 1.6.5:

Using resolver: lts-11.2

Warning: Installed version of cabal-install (2.0.0.1) is newer than stack has been tested with.  If you run into difficulties, consider downgrading.

Using compiler: ghc-8.2.2
Asking cabal to calculate a build plan...
Trying with packages from lts-11.2 and 3 external packages as hard constraints...
The following lines from cabal-install output could not be parsed: 
abstract-par-0.3.3 (via: monad-par-0.3.4.8 monad-par-extras-0.3.3) (new
package)
base-compat-0.9.3 (via: criterion-1.3.0.0 criterion-1.3.0.0 aeson-pretty-0.8.5

aeson-1.2.4.0 quickcheck-instances-0.3.18) (new package)

stack upgrade gives:

frank@oporto:~/Workspace8/LitTextWork/LitText$ stack upgrade
Current Stack version: 1.6.5, available download version: 1.6.5
Skipping binary upgrade, you are already running the most recent version

I assume that the output is harmless, but should be bypassed in this version? How would I downgrad the cabal? What is the last cabal version recommended?

Upvotes: 1

Views: 314

Answers (1)

duplode
duplode

Reputation: 34398

Stack issues #3453 and #3799 suggest this is a known bug in Stack. Until a fix for it lands, a makeshift workaround suggested in a comment to #3453 is using stack --resolver lts-9 install cabal-install to install cabal-install 1.24.0.2 (the executable, not the library).

Caveats:

  • The workaround assumes the local installation path Stack uses (cf. what stack path --local-bin tells you) has priority over the path of the globally installed cabal-install in hour PATH environment variable, or if you don't have a globally installed cabal-install to begin with (e.g. if you aren't using the Haskell Platform).

  • As hvr points out, this is not officially supported as far as Cabal and GHC are concerned, and you might run into further issues if features from newer cabal-install versions ever turn out to be necessary while using the solver via Stack.

  • If you ever need or want to have an up-to-date cabal-install, just use stack install cabal-install -- which will do it with the resolver you are using elsewhere. (If you have a globally installed cabal-install and want to go back to using it, you can simply delete the Stack-installed one from the location indicated by stack path --local-bin.)

Upvotes: 2

Related Questions