Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a workaround for Cabal broken reinstalls?

Tags:

haskell

cabal

Working with Cabal is so exhausting, I'm holding a copy of my latest working .cabal file so that when some other packages(especially executables like hakyll, which takes forever to reinstall) are broken, I can reload from latest save point.

But it still don't make some stuff easier because I can't install some packages without completely installing my packages in different order(ie. the package that breaks others should be installed before others etc.)

For example, here's what happens when I try to install cabal-dev(which is a very important package for me):

➜  ~  cabal install cabal-dev
Resolving dependencies...
In order, the following would be installed:
bytestring-0.9.2.1 (new version)
containers-0.4.2.1 (new version)
template-haskell-2.8.0.0 (reinstall) changes: containers-0.5.0.0 -> 0.4.2.1
text-0.11.2.3 (reinstall) changes: bytestring-0.10.0.0 -> 0.9.2.1
transformers-0.2.2.0 (new version)
mtl-2.0.1.0 (new version)
parsec-3.1.3 (reinstall) changes: bytestring-0.10.0.0 -> 0.9.2.1, mtl-2.1.2 ->
2.0.1.0
unix-2.3.2.0 (new version)
directory-1.0.0.3 (new version)
network-2.3.2.0 (new version)
HTTP-4000.2.6 (reinstall) changes: bytestring-0.10.0.0 -> 0.9.2.1, mtl-2.1.2
-> 2.0.1.0, network-2.4.0.1 -> 2.3.2.0
process-1.1.0.2 (reinstall) changes: directory-1.2.0.0 -> 1.0.0.3,
unix-2.6.0.0 -> 2.3.2.0
Cabal-1.14.0 (new version)
tar-0.3.2.0 (new package)
zlib-0.5.4.0 (reinstall) changes: bytestring-0.10.0.0 -> 0.9.2.1
cabal-dev-0.9.1 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
shakespeare-1.0.2
hamlet-1.1.2
hakyll-3.5.2.0
lens-3.7.1.2
ghc-7.6.1
haddock-2.13.1
data-lens-template-2.1.7
cmdargs-0.10.1
hoogle-4.2.14
QuickCheck-2.5.1.1
Extra-1.46
ipprint-0.4.2
xml-1.3.12
texmath-0.6.1.1
pandoc-1.9.4.5
wai-1.3.0.1
warp-1.3.6
tagsoup-0.12.8
snap-server-0.9.2.4
snap-core-0.9.2.2
regex-tdfa-1.1.8
Unixutils-1.52
network-2.4.0.1
simple-sendfile-0.2.10
network-conduit-0.6.2.1
citeproc-hs-0.3.6
language-lua-0.1.4
json-0.7
highlighting-kate-0.5.3.3
ddc-base-0.3.1.1
ddc-driver-0.3.1.3
ddc-core-simpl-0.3.1.1
ddc-core-llvm-0.3.1.1
ddc-build-0.3.1.3
ddc-core-salt-0.3.1.1
ddc-core-eval-0.3.1.1
ddc-core-0.3.1.1
http-types-0.7.3.0.1
hexpat-0.20.3
hashable-1.2.0.2
vault-0.2.0.3
unordered-containers-0.2.3.0
uniplate-1.6.10
case-insensitive-0.4.0.4
enumerator-0.4.19
zlib-enum-0.2.3
blaze-builder-enumerator-0.2.0.5
attoparsec-enumerator-0.3.1
conduit-0.5.5
blaze-builder-conduit-0.5.0.3
blaze-markup-0.5.1.4
blaze-html-0.5.1.3
blaze-builder-0.3.1.0
attoparsec-0.10.3.0
haskell98-2.0.0.2
Cabal-1.16.0
bin-package-db-0.0.0.0
zlib-bindings-0.1.1.2
zip-archive-0.1.2.1
Use --force-reinstalls if you want to install anyway.

And only workaround for this is to install cabal-dev before some other packages in that list. But I think even if I do that, it's not guaranteed that some other package won't be conflicted.

Now I'm wondering how are you handling conflicts in your cabal installation, and if there's a fix for this. I just can't install all libraries I need with Cabal. Any helps will be appreciated.

like image 598
sinan Avatar asked Jan 05 '13 08:01

sinan


1 Answers

The problem in this case is not Cabal or cabal-install(1), it's cabal-dev:

if impl(ghc >= 6.12)
  Build-depends:
    containers >= 0.3 && < 0.5

So with ghc-7.6.1, it refuses to use the containers package that came with it: very bad.

-- Require this specific version that came with GHC 6.10 because
-- of packaging problems with containers-0.2
if impl(ghc == 6.10)
  Build-depends:
    containers == 0.2.0.1

if impl(ghc == 6.8)
  Build-depends:
    containers == 0.1.0.2

Build-depends:
  bytestring >= 0.9 && < 0.10,

It doesn't accept the bytestring version either

  directory >= 1.0 && < 1.3,
  filepath >= 1.1 && < 1.4,
  Cabal >= 1.10.0.0 && < 1.15,

nor the Cabal version

  HTTP >= 4000.0.9 && < 4000.3,
  mtl >= 1.1 && < 2.1,

it will probably not be happy with the mtl version you have

  network >= 2.2 && < 2.4,

or network

  pretty >= 1.0 && < 1.2,
  process >= 1.0 && < 1.2,
  tar >= 0.3 && < 0.4,
  zlib >= 0.5 && < 0.6,
  transformers >= 0.2 && < 0.3,

or transformers

  -- Template haskell is special: the compiler will die if a
  -- version other than the one that is shipped with the compiler
  -- is used. Here, we don't constrain the version and hope that
  -- there will be only one.
  template-haskell

According to this, ghc-7.6.1 should be happy with the github version, so clone and build that.

(1) Well, part of the mess is because the hackage page doesn't show all dependencies for cabal-dev, only those for ghc-pkg-6_8-compat, namely base and cabal, so it isn't obvious that cabal-dev-0.9.1 doesn't work with ghc-7.6.

like image 160
Daniel Fischer Avatar answered Nov 04 '22 10:11

Daniel Fischer