GHC options in Cabal

Adrian Hey ahey at
Fri Jan 18 06:50:06 EST 2008

Duncan Coutts wrote:
> On Thu, 2008-01-17 at 13:51 +0000, Adrian Hey wrote:
>> Hello,
>> Looking at the latest Cabal docs, I see that in addition to ghc-options,
>> there are also ghc-prof-options and ghc-shared-options. What isn't clear
>> to me though from the docs is that are the latter two in addition to the
>> first, or are they a substitute for the first (for profiling/shared).
>> IOW, if I already have..
>> ghc-options: -O2
>> will the O2 also be applied to profiling build (say)? Or do I need an
>> extra explicit..
>> ghc-prof-options: -O2
> They are additive.
> I'm not at all convinced about these fields. It's not clear what their
> use cases are.
> As Adam says, adding -O is discouraged. If I had my way I'd make hackage
> require a performance profile to be supplied along with any package that
> wanted to use -O2 over -O.


Personally I'm not at all sure that having users specify all this stuff
on the command line is a good idea.

I thought policy was that (ideally) all users should have to do is
runghc Setup configure
runghc Setup build

If users don't like the defaults defined in the .cabal file they
can always edit it (that way they have a record of what was actually
used to build the package). I habitually add -split-objs to the
ghc-options of stuff I download, for example. I have read about
--enable-split-objs, I just don't like using it.

I do use --enable-library-profiling habitually, but only because I
haven't figured out how to put this in the .cabal file :-)

Adrian Hey

More information about the Libraries mailing list