Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've used the cabal package manager for Haskell programs to install libraries and new projects that I've cloned from some repositories. More often than not, I keep running into problems. Most projects make installing them seem super easy, but in my case that's not always true - sometimes they are very hard to get running. Some are so hard, in fact, that I've lost interest in the project solely because of not being able to install it.

So instead of complaining, I'd like to ask what I should do to better this situation. I'd like to use my most recent problem as an example.

I'm interested in trying out the Gitit project. It's a promising looking personal wiki that runs on various version control systems.

So here's what I've done:

  • Clone from Github
  • run cabal install in the project directory like I'm told on the project install page:

    mika@eka:~/git/gitit$ ls
    BLUETRIP-LICENSE  CHANGES  HCAR-gitit.tex  LICENSE  Network  README.markdown  RELANN-0.6.1  Setup.lhs  TANGOICONS  YUI-LICENSE  data  expireGititCache.hs  gitit.cabal  gitit.hs  plugins
    mika@eka:~/git/gitit$ cabal install
    Resolving dependencies...
    cabal: cannot configure happstack-server-7.0.7. It requires base64-bytestring
    For the dependency on base64-bytestring ==1.0.* there are these packages:
    base64-bytestring- However none of them are available.
    base64-bytestring- was excluded because gitit-0.10 requires
    base64-bytestring ==0.1.*
  • So now I'm thinking: well, I'll install happstack-server on its own, maybe that will work:

    mika@eka:~/git/gitit$ cabal install happstack-server
    Resolving dependencies...
    Warning: happstack-server.cabal: Ignoring unknown section type: test-suite
    Configuring happstack-server-7.0.7...
    cabal: At least the following dependencies are missing:
    blaze-html ==0.5.*,
    hslogger >=1.0.2,
    monad-control ==0.3.*,
    network >=2.2.3,
    sendfile >=0.7.1 && <0.8,
    system-filepath >=0.3.1,
    text >=0.10 && <0.12,
    threads >=0.5,
    transformers-base ==0.4.*
    cabal: Error: some packages failed to install:
    happstack-server-7.0.7 failed during the configure step. The exception was:
    ExitFailure 1
  • So looks like there are some dependencies missing. But isn't installing these dependencies the whole point of using cabal in the first place?

What should I do? File bug reports (to which project?), install the dependencies manually or something else? Bonus points for explaining what causes these kinds of problems.

share|improve this question
Try installing the dependencies one by one to see which ones fail. Sometimes a missing external (non-Haskell) dependency can cause the install to fail. – jpe Sep 30 '12 at 7:15
Also, check what the file indicated in the build-summary section of the ~/.cabal/config file tells you. – jpe Sep 30 '12 at 7:22
Have you run cabal update recently? – m4573r Sep 30 '12 at 9:17
up vote 4 down vote accepted

Projects with complex dependencies – and those that include a web server most likely fit in this class – are often best build with cabal-dev instead of cabal. The former installs everything in a sandbox and does not interfere with other installs.

So you should first install a fresh Haskell Platform, then fork the repository and finally build using cabal-dev. Of course you might install gitit with cabal-dev install gitit if you don't want to work on the source.

You should avoid global installs of complex projects.

share|improve this answer
This sounds like a very good practice! I'll see if that helps in this case. – sp3ctum Oct 26 '12 at 9:05

For anyone who stumbles upon this, I've discovered two important things that make cabal WAY less of a pain.

First, sandboxes are built in starting with cabal-install 1.18 (you don't need cabal-dev anymore). You should upgrade with cabal install cabal-install, and use them for everything! I create ~/.cabal/sandboxes and put one sandbox for each build in there. Then I link finished binaries into ~/.cabal/bin with ln.

Second, if your distro (Debian, for example) doesn't give /tmp execute permissions it will cause all sorts of seemingly unrelated errors. Things like configure: error: cannot run C compiled programs. It's easy to fix with alias cabal="TMPDIR=/somewhere/with/permission cabal".

share|improve this answer
TMPDIR=~/tmp cabal install ... saved my night! Thanks for the tip. – Bruno Kim Nov 21 '14 at 5:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .