What is the procedure for profiling under GHC 7.10.1 and cabal 1.23?

294 views Asked by At

What is the recommended procedure for profiling under GHC 7.10.1 and cabal 1.23? The profiling-related error and warning messages from GHC and cabal-install are very inconsistent.

  1. Try to run an executable with profiling, and you are told:

    $ prediction-interactive +RTS -p
    
    prediction-interactive: the flag -p requires the program to be built with -prof
    
  2. Put -prof in your cabal file, and you are told:

    $ cabal build
    
    Warning: 'ghc-options: -prof' is not necessary and will lead to problems when
    used on a library. Use the configure flag --enable-library-profiling and/or
    --enable-executable-profiling.
    
  3. Follow that advice (and remove -prof from the cabal file), and you are told:

    $ cabal configure --enable-executable-profiling
    
    Resolving dependencies...
    Configuring creatur-wains-prediction-1.0...
    Warning: The flag --enable-executable-profiling is deprecated. Please use
    --enable-profiling instead.
    
  4. Follow that advice, and you are told:

    $ cabal configure --enable-profiling
    
    Resolving dependencies...
    Configuring creatur-wains-prediction-1.0...
    
    $ cabal build
    
    . . .
    Installing executable(s) in
    /home/eamybut/nosync/sandboxes/prediction-wains/bin
    Installed creatur-wains-prediction-1.0
    
    $ prediction-interactive +RTS -p
    
    prediction-interactive: the flag -p requires the program to be built with -prof
    

Facepalm!

EDIT: Added cabal build in step 4.

0

There are 0 answers