So I'm trying to install a package with a big messy dependency set (gitit, in this case). A direct cabal install
from hackage forces rebuilds of plenty of libraries I don't want to rebuild (having to do with constraints on text
, constraints on network
, constraints on parsec
, etc.) I did the right thing, ran cabal unpack gitit
, manually edited the .cabal file, and successfully put it through a cabal configure
, cabal build
cycle. So far, so good.
Now, I want to run a cabal install
. In the good old days (last year), this would just install the already built binaries and files where they belong. However, now, running cabal install
runs the dependency checker, which decides that all the packages that I'm building with don't use the same parsec
, etc., and tries to reinstall them anyway! Even though I just ran a perfectly fine cabal build
. What's the magic flag to turn this off and get the old, not-clever, and perfectly acceptable behavior?
Looking at the flags, there doesn't seem to be any indication of cabal install
doing this. In times of yore, before cabal install
and when you had to manually get your own packages, the incantation at the install stage was runghc Setup install --user
after you had run runghc Setup configure --prefix=$FOO --user
- perhaps this will work? Setup.hs will not automatically invoke 'build' when you tell it to 'install', if my memory serves correctly.
Now, for the future, if you want to avoid this entire nasty dependency hell, I would highly suggest you use cabal-dev
which will sandbox your package installations and never touch your actual user/global package database, in this case you'd just do:
$ cabal unpack gitit
$ cd gitit-0.8.0.1 # latest hackage version
$ cabal-dev install
It'll properly download and install all the needed dependencies like cabal install, but it'll sandbox them by creating a ./cabal-dev
directory containing a self-contained package database. It never touches your global or user package db in ~/.ghc/
. cabal-dev
effectively makes editing cabal files and dealing with the diamond dependency problems Cabal faces a thing of the past, the way cabal-install
made manually downloading packages a thing of the past.
It also turns out that there is an --only
flag that lets one build and install only that package, just as the ./Setup
route does.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With