[Haskell-cafe] Cabal version constraint seems to be ignored.

Albert Y. C. Lai trebla at vex.net
Sun Jan 26 19:16:57 UTC 2014


On 14-01-22 07:43 AM, Carlo Hamalainen wrote:
> I have two versions of Cabal, both are visible:
>
> $ ghc-pkg expose Cabal-1.16.0
> $ ghc-pkg expose Cabal-1.18.1.2
>
> I clone and build my package. Since I have GHC 7.6.3 it uses
> Cabal-1.16.0 (as specified in ghc-imported-from.cabal):

> But my program doesn't run:

> But I can't expect a user to know that they have to hide Cabal-1.18.1.2.

It seems that you are using GHC API. Then your program starts a GHC 
session, which is not unlike an average ghci session, in particular:

A. It will load and link libraries afresh during run time. This is 
independent of whatever your executable is linked with.

B. And the default choice of libraries is, clearly: the newest unhidden 
version.

Therefore, when your GHC session also has to work with compiled code 
built against older versions, there will be incompatibilities.

What do you tell your users?

I don't know. This is just one tip of a problem so widespread and 
entrenched, you cannot solve it alone. I cannot solve it alone, unless I 
am Imperator for Life.

The problem is cultural and due to opinion leaders. The problem is: 
believing that multiple versions co-exist happily.

Opinion leaders themselves do not run into troubles because they are 
cabal experts and they always tread cunningly through the jungle of 
multiple versions.

That is what's wrong with opinion leaders. They are so expert that their 
ways are unsuitable for the rest of us.

For the rest of us, cabal-install would be much better off defaulting to 
disallowing multiple versions in the first place. (It could provide 
overriding options to the experts.)

In the particular case of the library Cabal 1.16 vs 1.18, Duncun Coutts 
explicitly said in IRC freenode #haskell that their co-existence is 
pretty harmless.

Let your trouble be a lesson against that leader opinion. And let 
ghc-mod's trouble be another.


P.S. cabal-install goes out of its way to dictate library versions to 
ghc. It begins with -hide-all-packages, then it recites, one by one, 
-package base-4.1.0.0, -package Cabal-1.16.0, -package text-0.11.3.1,... 
Are you going to bother to do the same?


More information about the Haskell-Cafe mailing list