[Haskell-cafe] Cabal version constraint seems to be ignored.
Carlo Hamalainen
carlo at carlo-hamalainen.net
Wed Jan 22 12:43:34 UTC 2014
Hi,
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):
$ git clone https://github.com/carlohamalainen/ghc-imported-from
$ cd ghc-imported-from
$ cabal install
It looks like Cabal-1.16.0 was chosen, as expected:
$ grep Cabal dist/build/autogen/cabal_macros.h
/* DO NOT EDIT: This file is automatically generated by Cabal */
/* package Cabal-1.16.0 */
#define VERSION_Cabal "1.16.0"
#define MIN_VERSION_Cabal(major1,major2,minor) (\
But my program doesn't run:
$ ghc-imported-from src/Main.hs Main getArgs 11 11 --ghc-options
--ghc-pkg-options
GhcOptions []
GhcPkgOptions []
Language/Haskell/GhcImportedFrom.hs:132:54:
Couldn't match expected type `Distribution.PackageDescription.BuildInfo'
with actual type
`Cabal-1.16.0:Distribution.PackageDescription.BuildInfo'
In the fourth argument of `getGHCOptions', namely `binfo'
In a stmt of a 'do' block:
getGHCOptions [] c (fromJust $ cradleCabalDir c) binfo
In the expression:
do { c <- findCradle;
pkgDesc <- GhcMonad.liftIO
$ parseCabalFile $ fromJust $ cradleCabalFile c;
let binfo = head $ cabalAllBuildInfo pkgDesc;
getGHCOptions [] c (fromJust $ cradleCabalDir c) binfo }
I'm surprised that the error didn't appear at compile time. I guess the
first reference to Distribution.PackageDescription.BuildInfo is from
Cabal-1.18.1.2?
If I hide Cabal-1.18.1.2 then things work ok:
$ ghc-pkg hide Cabal-1.18.1.2
$ cabal install
$ ghc-imported-from .... (runs as expected)
But I can't expect a user to know that they have to hide Cabal-1.18.1.2.
Is this actually a GHC bug or have I stuffed up my
ghc-imported-from.cabal file?
Thanks,
--
Carlo Hamalainen
http://carlo-hamalainen.net
More information about the Haskell-Cafe
mailing list