2

I'm trying to build my Hakyll site using Travis-CI. However, before I even get that far, I have a dependencies error when trying to install Hakyll as a dependency.

I can build Hakyll locally on my machine with no problems. What might be causing the dependency error, and how can it be resolved? Is there a way to resolve it without actually hard-coding each dependency version?

Here's the output that comes from TravisCI.

travis_fold:end:git.5
$ export PATH=/usr/local/ghc/$(ghc_find 7.6)/bin/:$PATH
travis_fold:start:cabal
$ cabal update
Config file path source is default config file.
Config file /home/travis/.cabal/config not found.
Writing default configuration to /home/travis/.cabal/config
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
travis_fold:end:cabal
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
$ cabal --version
cabal-install version 1.18.0.2
using version 1.18.1 of the Cabal library 
travis_fold:start:before_install.1
$ cabal update
Downloading the latest package list from hackage.haskell.org
Note: there is a new version of cabal-install available.
To upgrade, run: cabal install cabal-install
travis_fold:end:before_install.1
travis_fold:start:before_install.2
$ cabal install hakyll pandoc
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: hakyll-4.5.3.0 (user goal)
trying: base-4.6.0.1/installed-8aa... (dependency of hakyll-4.5.3.0)
trying: hakyll-4.5.3.0:+checkexternal
trying: http-conduit-2.1.2.3 (dependency of hakyll-4.5.3.0:+checkexternal)
trying: http-client-0.3.3.2 (dependency of http-conduit-2.1.2.3)
trying: exceptions-0.6.1 (dependency of http-client-0.3.3.2)
trying: transformers-0.4.1.0 (dependency of http-conduit-2.1.2.3)
next goal: mtl (dependency of hakyll-4.5.3.0)
rejecting: mtl-2.2.1, 2.2.0.1, 2.2 (conflict: hakyll => mtl>=1 && <2.2)
rejecting: mtl-2.1.3.1, 2.1.2 (conflict: transformers==0.4.1.0, mtl =>
transformers==0.3.*)
rejecting: mtl-2.1.1, 2.1 (conflict: base==4.6.0.1/installed-8aa..., mtl =>
base<4.6)
rejecting: mtl-2.0.1.1 (conflict: transformers==0.4.1.0, mtl =>
transformers==0.2.*)
rejecting: mtl-2.0.1.0, 2.0.0.0 (conflict: base==4.6.0.1/installed-8aa..., mtl
=> base<4.6)
rejecting: mtl-1.1.1.1, 1.1.1.0, 1.1.0.2, 1.1.0.1, 1.1.0.0, 1.0 (conflict:
exceptions => mtl>=2.0 && <2.3)
Backjump limit reached (change with --max-backjumps).

[31;1mThe command "cabal install hakyll pandoc" failed and exited with 1 during .[0m

Your build has been stopped.

If there's any other output that would be useful, let me know and I can provide it.

Ganesh Sittampalam
  • 28,821
  • 4
  • 79
  • 98
jmite
  • 8,171
  • 6
  • 40
  • 81
  • Not a huge fan of the edit, as the error seems to be specific to Travis-CI and this site encourages informative titles. – jmite Jul 02 '14 at 21:12
  • 1
    I've rolled back the edit as I agree it made the question worse. – Ganesh Sittampalam Jul 02 '14 at 21:19
  • Do you have control over how cabal install is run on travis-ci? Could you run it with --max-backjumps=-1 ? If you need to add constraints I'd start by choosing a specific hakyll version that you know works locally with the same GHC as travis-ci is using. – Ganesh Sittampalam Jul 02 '14 at 21:20
  • Yeah, the travis-CI config file is basically like a bash script that gets run. I'll try with -1 backjump and see what we get, I'm suspicious that either their configuration changed, or isn't consistent across servers, since this problem didn't exist yesterday but has only started today. – jmite Jul 02 '14 at 21:23
  • Interesting, it worked. Maybe their cabal config had max backjumps set really low... it took a while though, around 4 minutes (Which isn't terrible relative to Travis-CI's normal speed). – jmite Jul 02 '14 at 21:31

1 Answers1

5

The first thing to try if you get Backjump limit reached from cabal-install is to try again with the option --max-backjumps=-1 which means "search exhaustively", though if it then ends up taking tens of minutes you'd need to interrupt it or rely on the Travis-CI timeout. You can also use 500 or 1000 rather than -1 for a large but limited search - the default is 200.

If that doesn't work then try to pick out specific projects to constrain to a specific version with the option --constraint 'foo==0.1.0.0, preferably one that you actually know should be installable with the same GHC version.

In this particular case, the following two lines suggest that hakyll itself was at the root of the problem:

rejecting: mtl-2.2.1, 2.2.0.1, 2.2 (conflict: hakyll => mtl>=1 && <2.2)
rejecting: mtl-2.1.1, 2.1 (conflict: base==4.6.0.1/installed..., mtl => base<4.6)

In other words, base, which is tied to the GHC version, seems to require mtl>=2.2 (or perhaps less than 2.1 but I suspect that wouldn't have worked either). hakyll was requiring mtl<2.2, so there seemed to be a fundamental conflict implying that this version of hakyll wouldn't work this version of base.

Ganesh Sittampalam
  • 28,821
  • 4
  • 79
  • 98
  • 3
    I'm not entirely sure if this answer is worthwhile or the question should just be closed as either being unlikely to help future readers or a duplicate, but I searched for questions about cabal-install that mention `--max-backjumps` and didn't find any, so perhaps some general guidance on handling the problem is useful. – Ganesh Sittampalam Jul 02 '14 at 21:43