
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 1.6.0.2, 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? Thanks Neil

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 1.6.0.2, 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-1.6.0.2 registered? If you built Cabal-1.6.0.2 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 1.2.3.0 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. Duncan

Hi Duncan,
i.e. cabal accepts the --builddir command, but the setup that cabal builds doesn't. Why?
Hmm. Does your ghc-6.8 have Cabal-1.6.0.2 registered? If you built Cabal-1.6.0.2 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.
Cabal-1.6.0.2 is registered and built with ghc-6.8.3 - I installed it with Cabal seconds before running this example. My cabal.exe comes from the hackage website, the binary you put up some time ago. I guess that is probably the issue.
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.
Meh. Custom build scripts are brittle and evil - in my particular case the custom build script was trivial so adding build-type:Simple fixes everything. However, I'd like to know (before I push a change) that build-type:Simple will work out the box with the Cabal that got installed with ghc-6.8.3. So that means figuring out what Cabal ghc-6.8.3 shipped with, and which Cabal can cope with build-type:Simple - is there any way to figure that out in general, and what is the answer in this specific case? Thanks Neil

On Wed, Feb 25, 2009 at 11:58 AM, Neil Mitchell
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.
Meh. Custom build scripts are brittle and evil - in my particular case the custom build script was trivial so adding build-type:Simple fixes everything. However, I'd like to know (before I push a change) that build-type:Simple will work out the box with the Cabal that got installed with ghc-6.8.3. So that means figuring out what Cabal ghc-6.8.3 shipped with, and which Cabal can cope with build-type:Simple - is there any way to figure that out in general, and what is the answer in this specific case?
It would be nice if the user guide specified in which Cabal version a field was first introduced. Aside: I often wish that Haskell libraries specified the library version in which a function was added. Python does this for their library APIs. It would be very helpful in figuring out the lower bounds when specifying library dependencies. I guess it would be possible to write a tool that extracts this information. Also, does the user guide specify how Cabal handles unknown fields? Cheers, Johan

On Wed, 2009-02-25 at 12:26 +0100, Johan Tibell wrote:
On Wed, Feb 25, 2009 at 11:58 AM, Neil Mitchell
wrote: 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.
Meh. Custom build scripts are brittle and evil - in my particular case the custom build script was trivial so adding build-type:Simple fixes everything. However, I'd like to know (before I push a change) that build-type:Simple will work out the box with the Cabal that got installed with ghc-6.8.3. So that means figuring out what Cabal ghc-6.8.3 shipped with, and which Cabal can cope with build-type:Simple - is there any way to figure that out in general, and what is the answer in this specific case?
It would be nice if the user guide specified in which Cabal version a field was first introduced.
If someone has the time that'd be great. I'd certainly accept patches along those lines. Generally the user guide needs some attention from someone. It could probably do with being divided into user and author sections / perspectives. People want to know how to install packages, all the various user interface to using the command line interface. Different people (or the same people but doing a different task) want to know the details of how to write cabal packages.
Aside: I often wish that Haskell libraries specified the library version in which a function was added. Python does this for their library APIs. It would be very helpful in figuring out the lower bounds when specifying library dependencies. I guess it would be possible to write a tool that extracts this information.
Yes, if we extract the api from each older version and feed it as input to haddock.
Also, does the user guide specify how Cabal handles unknown fields?
Looks like it does not say. Unknown fields generate a warning and are otherwise ignored. Unknown fields starting with "x-" generate no warning and are collected into a list of name/value pairs that is exposed through the api. Duncan

On Wed, Feb 25, 2009 at 01:09:38PM +0000, Duncan Coutts wrote:
Generally the user guide needs some attention from someone. It could probably do with being divided into user and author sections / perspectives. People want to know how to install packages, all the various user interface to using the command line interface. Different people (or the same people but doing a different task) want to know the details of how to write cabal packages.
Do you mean it should have separate sections on "Creating a package" and "Building and installing a package"?

On Wed, 2009-02-25 at 16:29 +0000, Ross Paterson wrote:
On Wed, Feb 25, 2009 at 01:09:38PM +0000, Duncan Coutts wrote:
Generally the user guide needs some attention from someone. It could probably do with being divided into user and author sections / perspectives. People want to know how to install packages, all the various user interface to using the command line interface. Different people (or the same people but doing a different task) want to know the details of how to write cabal packages.
Do you mean it should have separate sections on "Creating a package" and "Building and installing a package"?
Ok ok :-) I always get the feeling nobody reads the user guide. Perhaps it's just me who never reads it. I don't think it's exposed to the users enough, despite it being just one click away on the cabal home page. We have all these other links on the home page on how to install and make a package. Why do we have these if we've got the user guide? Half of it is out of date now that most people use cabal-install. Not very different of course. Perhaps we just need to integrate this material and have some more tutorial style stuff in the user guide. Then instead of calling it "user guide" on the home page, we just link "How to install a Cabal package" and "How to make a Cabal package" directly to the appropriate chapters. Duncan

On Wed, 2009-02-25 at 10:58 +0000, Neil Mitchell wrote:
Hi Duncan,
i.e. cabal accepts the --builddir command, but the setup that cabal builds doesn't. Why?
Hmm. Does your ghc-6.8 have Cabal-1.6.0.2 registered? If you built Cabal-1.6.0.2 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.
Cabal-1.6.0.2 is registered and built with ghc-6.8.3 - I installed it with Cabal seconds before running this example.
Did you see from the -v3 output what version it was actually using? If you compile Setup.hs manually using -package Cabal-1.6.0.2 does the --builddir= flag work? It should do.
My cabal.exe comes from the hackage website, the binary you put up some time ago. I guess that is probably the issue.
What version is that then? I'm interested because we've not actually worked out why the problem was occurring.
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.
Meh. Custom build scripts are brittle and evil - in my particular case the custom build script was trivial so adding build-type:Simple fixes everything. However, I'd like to know (before I push a change) that build-type:Simple will work out the box with the Cabal that got installed with ghc-6.8.3.
It will.
So that means figuring out what Cabal ghc-6.8.3 shipped with,
1.2.3.0
and which Cabal can cope with build-type:Simple - is there any way to figure that out in general, and what is the answer in this specific case?
If you're lucky, "cabal check" will tell you that you're using features but not specifying a high enough cabal-version: >=x.y value. Otherwise you can consult old versions of the user guide or the source. Duncan

Hi
My cabal.exe comes from the hackage website, the binary you put up some time ago. I guess that is probably the issue.
What version is that then?
I'm interested because we've not actually worked out why the problem was occurring.
We still haven't since I'm now not able to replicate the problem... My best guess is that I had Cabal old installed, which didn't support --builddir. I upgraded to Cabal new which did. Cabal install had cached the Setup.exe program built before the upgrade so that the Setup.exe still used Cabal old. Now, when I try again today, it picks up Cabal new. I guess there is a potential bug that cabal install should perhaps rebuild setup.exe if the cabal version has changed, but that might be difficult to track and is very much a corner case.
everything. However, I'd like to know (before I push a change) that build-type:Simple will work out the box with the Cabal that got installed with ghc-6.8.3.
It will.
Fantastic. If I break everyones build, I'm blaming you :-) Thanks Neil

On Wed, 2009-02-25 at 13:42 +0000, Neil Mitchell wrote:
Hi
My cabal.exe comes from the hackage website, the binary you put up some time ago. I guess that is probably the issue.
What version is that then?
I'm interested because we've not actually worked out why the problem was occurring.
We still haven't since I'm now not able to replicate the problem...
My best guess is that I had Cabal old installed, which didn't support --builddir. I upgraded to Cabal new which did. Cabal install had cached the Setup.exe program built before the upgrade so that the Setup.exe still used Cabal old. Now, when I try again today, it picks up Cabal new.
Yes that's quite plausible. It forgets what version of Cabal was used to build Setup. So it's not rebuilt if it changes.
I guess there is a potential bug that cabal install should perhaps rebuild setup.exe if the cabal version has changed, but that might be difficult to track and is very much a corner case.
Right. It's not that tricky though. We'd have to record another state file in dist/setup/.
everything. However, I'd like to know (before I push a change) that build-type:Simple will work out the box with the Cabal that got installed with ghc-6.8.3.
It will.
Fantastic. If I break everyones build, I'm blaming you :-)
Heh. I'm confident. :-) Duncan
participants (4)
-
Duncan Coutts
-
Johan Tibell
-
Neil Mitchell
-
Ross Paterson