Understanding cabal dependency messages

2019-07-30 01:19发布

问题:

currently when I try to install GOA I get the following message :

>sudo cabal install goa
Resolving dependencies...
In order, the following would be installed:
directory-1.1.0.2 (reinstall) changes: filepath-1.3.0.0 -> 1.2.0.1
process-1.0.1.5 (new version)
goa-3.1 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
....

My question is whether this means that I currently have "filepath-1.3.0.0" as default, and cabal (upon a --force-reinstalls) is going to override this and make "filepath-1.2.0.1" as default? The reason I am a bit confused is that when I look in the location :

cabal/packages/hackage.haskell.org/filepath

I find both 1.2.0.1 & 1.3.0.0 present. Furthermore the command "cabal list filepath" indicates that both packages are installed (see "Installed versions: 1.2.0.1, 1.3.0.0" in the below) :

>cabal list filepath
......
* filepath
    Synopsis: Library for manipulating FilePaths in a cross platform way.
    Default available version: 1.3.0.1
    Installed versions: 1.2.0.1, 1.3.0.0
    Homepage: http://www-users.cs.york.ac.uk/~ndm/filepath/
    License:  BSD3

回答1:

Right now, you have directory-1.1.0.2 installed and built with filepath-1.3.0.0.

The issue here is that you're installing goa which requires filepath (≥1.1 & <1.3), and directory (≥1.0 & <1.2). You already have all the right packages installed, but directory was built with a too new version of filepath. Cabal-install's solution to this conflict is to rebuild directory so that it uses the older version of filepath. All of this is done because you shouldn't have multiple versions of the same package in the dependencies of a package (goa in this case).