Dependency version problem with Cabal

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Mar 19 06:46:32 EDT 2009


On Wed, 2009-03-18 at 15:34 -0700, jutaro wrote:
> In my leksah.cabal file i have the package dependency Cabal >=1.6.0.1.
> When I have installed Cabal-1.6.0.2 as well a s1.6.0.1 I get the following
> warning:
> 
> Warning: This package indirectly depends on multiple versions of the same
> package. This is highly likely to cause a compile failure.
> package ghc-6.10.1 requires Cabal-1.6.0.1
> package leksah-0.4.3 requires Cabal-1.6.0.2
> 
> Why does this happen, as leksah does not require Cabal-1.6.0.2?
> How can I solve this problem?

The runghc Setup configure uses a simple algorithm to decide what
versions of packages should be used. It always picks the latest
installed versions.

However then it checks if the configuration it picked means that
directly or indirectly we end up depending on multiple versions of the
same package. It does that check because depending on multiple versions
of the same package is often a mistake and leads to compile failure.

So it's saying that leksah requires Cabal-1.6.0.2 only because it went
and picked the latest version of Cabal.

Now in this case the warning is probably superfluous. It's unlikely that
the bits of the Cabal library that ghc re-exports are bits that you
directly import from Cabal. So it'll probably work.

Note that you will not get the warning if you use the "cabal
configure" (at least the latest version) or "cabal install" commands.
That's because these two commands use a more sophisticated algorithm to
decide what versions of packages should be used. In this case they would
probably end up picking Cabal-1.6.0.1 and everything would be ok.

If you want to use the runghc Setup configure method and don't like the
warning you can tell it to pick a different version:

runghc Setup configure --constraint="Cabal == 1.6.0.1"


Duncan



More information about the Libraries mailing list