Skip to content

In users_guide/profiling.xml : -prof flag not to be used with cabal/stack

The documentation for compiling with cost centre profiling support is here: https://github.com/ghc/ghc/blob/master/docs/users_guide/profiling.xml#L79

It says:

Compile and run this program as follows:

$ ghc -prof -fprof-auto -rtsopts Main.hs
$ ./Main +RTS -p
121393
$

This is not the case when cabal or stack are used, as -prof should be omitted, i.e.

cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-fprof-auto -rtsopts"

If the user does not know this and includes -prof in the --ghc-options string, they are likely to see compiler error messages relating to p_dyn, e.g.

Failed to load interface for ‘GHC.Integer.Type’
Perhaps you haven't installed the "p_dyn" libraries for package ‘integer-gmp-1.0.0.0’?
Use -v to see a list of the files searched for.

Given that other parts of the profiling.xml file does refer to cabal, do people agree that it might be helpful to make it explicit in Section "5.1. Cost centres and cost-centre stacks", that using ghc directly -prof should be used (no change to the XML file):

$ ghc -prof -fprof-auto -rtsopts Main.hs

Though if cabal/stack is being used, the -prof should be omitted (an addition to the XML file):

$ cabal install --enable-executable-profiling --enable-library-profiling --ghc-options="-fprof-auto -rtsopts"
Trac metadata
Trac field Value
Version 7.10.2
Type Bug
TypeOfFailure OtherFailure
Priority lowest
Resolution Unresolved
Component Documentation
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information