Cabal --builddir

Duncan Coutts duncan.coutts at
Tue Feb 24 17:51:43 EST 2009

On Tue, 2009-02-24 at 14:24 +0000, Neil Mitchell wrote:
> Hi,
> Cabal documents itself as having a --builddir command to change the
> placement of dist stuff, which is fantastic.
> However, running with GHC 6.8.3, Cabal, I get:
> cabal build --builddir=../../../_make/Tools/ext/haddock-0.9/dist
> setup.exe: Unrecognised flags:
>  --builddir=../../../_make/Tools/ext/haddock-0.9/dist
> i.e. cabal accepts the --builddir command, but the setup that cabal
> builds doesn't. Why?

Hmm. Does your ghc-6.8 have Cabal- registered? If you built
Cabal- and cabal-install with ghc-6.10 but not also for 6.8 then
cabal-install will be forced to pick an older Cabal lib when compiling
Setup scripts for 6.8.

You can check what it is doing. Clean and run with -v3 and near the top
you should see something like:

Using external setup method with build-type Simple
Creating ./mydist/setup (and its parents)
Using Cabal library version
Using ./mydist/setup/setup.hs as setup script.
Setup script is out of date, compiling...
("/usr/local/bin/ghc-6.8.2",["-v","--make",  ... etc

So if it's forced to pick an older Cabal lib version then the Setup will
not grok --builddir.

Really of course we should notice this earlier and complain that we
cannot use this new feature while using the older lib version. We should
file a ticket about that. In fact the whole issue with what the Setup
command line must accept is a tricky issue when it comes to working with
custom build systems.


More information about the cabal-devel mailing list