haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 691 forks source link

Cabal could not resolve dependencies #2417

Closed TheLinuxKitten closed 9 years ago

TheLinuxKitten commented 9 years ago

On a default FreeBSD installed system cabal can't resolve dependecies, it has problems with the base libraries installed (mtl? due to transformers-0.3.0.0) by ghc:

I've just installed the latest stable version of FreeBSD 10.1 (using a preinstalled image disk for KVM). Then I've installed GHC:

kitten@freebsdbox: % sudo pkg install ghc hs-haddock hs-cabal-install
kitten@freebsdbox: % ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.3
kitten@freebsdbox: % cabal update
kitten@freebsdbox: % cabal install cabal-install
kitten@freebsdbox: % setenv path=(~/.cabal/bin $path)
kitten@freebsdbox: % cabal --version
cabal-install version 1.22.0.0
using version 1.22.0.0 of the Cabal library 
kitten@freebsdbox: % mkdir -p ~/hs-sandboxes/hs-kutil ; cd ~/hs-sandboxes/hs-kutil
kitten@freebsdbox:~/hs-sandboxes/hs-kutil % cabal sandbox init --sandbox .
.... (add my source projects which use optparse-applicative>=0.9) ....
kitten@freebsdbox:~/hs-sandboxes/hs-kutil % cabal install gitlist ghcutil
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: gitlist-0.1.0.0 (user goal)
next goal: optparse-applicative (dependency of gitlist-0.1.0.0)
rejecting: optparse-applicative-0.11.0.1, 0.11.0, 0.10.0, 0.9.1.1, 0.9.1,
0.9.0 (conflict: transformers-compat==0.4.0.4, optparse-applicative =>
transformers-compat==0.3.*)
rejecting: optparse-applicative-0.8.1, 0.8.0.1, 0.8.0, 0.7.0.2, 0.7.0.1,
0.7.0, 0.6.0, 0.5.2.1, 0.5.2, 0.5.1, 0.5.0, 0.4.3, 0.4.2, 0.4.1, 0.4.0, 0.3.2,
0.3.1, 0.3.0, 0.2.0, 0.1.1, 0.1.0 (conflict: transformers==0.4.2.0,
optparse-applicative => transformers>=0.2 && <0.4)
trying: optparse-applicative-0.0.1
next goal: ghcutil (user goal)
rejecting: ghcutil-0.1.0.0 (conflict: optparse-applicative==0.0.1, ghcutil =>
optparse-applicative>=0.9)
Dependency tree exhaustively searched.

Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

The list of installed packages is:

kitten@freebsdbox: % ghc-pkg list
/usr/local/lib/ghc-7.8.3/package.conf.d:
    Cabal-1.18.1.3
    HTTP-4000.2.10
    array-0.5.0.0
    base-4.7.0.1
    bin-package-db-0.0.0.0
    binary-0.7.1.0
    rts-1.0
    bytestring-0.10.4.0
    containers-0.5.5.1
    deepseq-1.3.0.2
    directory-1.2.1.0
    filepath-1.3.0.2
    (ghc-7.8.3)
    ghc-paths-0.1.0.9
    ghc-prim-0.3.1.0
    haddock-2.14.3
    haskeline-0.7.1.2
    (haskell2010-1.1.2.0)
    (haskell98-2.0.0.3)
    hoopl-3.10.0.1
    hpc-0.6.0.1
    integer-gmp-0.5.1.0
    mtl-2.1.3.1
    network-2.4.2.3
    old-locale-1.0.0.6
    old-time-1.1.0.2
    parsec-3.1.5
    pretty-1.1.1.1
    process-1.2.0.0
    random-1.0.1.1
    stm-2.4.2
    template-haskell-2.9.0.0
    terminfo-0.4.0.0
    text-1.1.0.0
    time-1.4.2
    transformers-0.3.0.0
    unix-2.7.0.1
    xhtml-3000.2.1
    zlib-0.5.4.1

/home/kitten/.ghc/x86_64-freebsd-7.8.3/package.conf.d:
    Cabal-1.22.0.0

I've tried with flags like '--max-backjumps=-1' or '--reorder-goals' (seen in other issues comments) with the same result. Any suggestion, please?

kosmikus commented 9 years ago

A general comment: Dependency tree exhaustively searched. means there is no solution, so unless you change the problem, just adding flags such as increasing the number of backjumps or reordering the goals won't help.

As the error message you're getting states, you have a relatively strong conflict in the Cabal thinks it must use transformers-compat version 0.4.0.4, but optparse-applicative forces 0.3.*. It's not clear to me where the transformers-compat version 0.4.0.4 constraint comes from. It may be hidden in your "(add my source projects which use optparse-applicative>=0.9)" line.

Could you provide more information, for example re-post the failing cabal-install invocation using -v3?

TheLinuxKitten commented 9 years ago

Thanks @kosmikus.

The output of cabal install -v3 happy gitlist ghcutil are two pastebin:

Yes, one package (gitlist) has dependency of transformers>=0.4.1 because it uses Control.Monad.Except (mtl-2.2.1).

I'm a bit confusing. On my Debian Wheezy host I've installed the same package (gitlist) in a sandbox without problems. On Debian I'm using GHC 7.8.4 with transformers-0.3.0.0 as global package, and gitlist with transformers-0.4.2.0 and mtl-2.2.1 sandboxed. Cabal installed them in the sandbox without any conflict with the global package transformers-0.3.0.0.

My packages on Debian:

$ ghc-pkg list
/home/thelinuxkitten/opt/ghc/lib/ghc-7.8.4/package.conf.d
   Cabal-1.18.1.5
   array-0.5.0.0
   base-4.7.0.2
   bin-package-db-0.0.0.0
   binary-0.7.1.0
   bytestring-0.10.4.0
   containers-0.5.5.1
   deepseq-1.3.0.2
   directory-1.2.1.0
   filepath-1.3.0.2
   ghc-7.8.4
   ghc-prim-0.3.1.0
   haskeline-0.7.1.2
   haskell2010-1.1.2.0
   haskell98-2.0.0.3
   hoopl-3.10.0.1
   hpc-0.6.0.1
   integer-gmp-0.5.1.0
   old-locale-1.0.0.6
   old-time-1.1.0.2
   pretty-1.1.1.1
   process-1.2.0.0
   rts-1.0
   template-haskell-2.9.0.0
   terminfo-0.4.0.0
   time-1.4.2
   transformers-0.3.0.0
   unix-2.7.0.1
   xhtml-3000.2.1

and in the sandbox (Debian):

╭─thelinuxkitten@thelinuxkitten  ~/hs-sandboxes/hs-kutil sandboxed
╰─$ ls lib/x86_64-linux-ghc-7.4.1/
ansi-terminal-0.6.2.1/   HsUtil-0.1.0.0/                 transformers-0.4.2.0/
ansi-wl-pprint-0.6.7.1/  mtl-2.2.1/                      transformers-base-0.4.3/
ghci-conf-0.1.0.0/       optparse-applicative-0.11.0.1/  transformers-compat-0.3.3.4/
haskell-lexer-1.0/       pretty-show-1.6.8/

I'm newbee in haskell and cabal dependencies, I only see that is posible to install other versions of global packages in a sandbox without problems, but I can't do in a fresh installed FreeBSD. My next try is to install GHC 7.8.4 from sources on FreeBSD (like on Debian) and try again.

Suggestions are wellcome.

Thanks

TheLinuxKitten commented 9 years ago

I'm dumb... my working sandbox was created with GHC 7.4.1.