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.
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
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.
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.
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.
cabal build
now? – Paulinepaulingcabal run -- +RTS -p
to run the executable that cabal has just built, or invoke it via its pathdist/...
.) – Paulinepaulingbin
directory in the sandbox. That binary has the timestamp of the last time I changed anything and didcabal build
. But now when I run it usingcabal run -- +RTS -p
, it creates a new executable, which does work, and I get profiling info as expected. Maybecabal build
doesn't produce a new executable unless there's been a change in source code (as opposed to a change to the cabal file)? I'll have to experiment. – Farmhousecabal build
to ever install anything into the sandbox. So that part has me a bit confused. I expectcabal build
to build an executable todist/build/foo/foo
and forcabal run
to run that executable. – Paulinepaulingdist
directory as being full of stuff I don't need to see. In my minddist
had nothing to do with sandboxes, since sandboxes didn't exist in the beginning. With non-sandboxed builds, any executable produced goes into your.cabal/bin
. So then when sandboxes became a thing, there was this new directory (the sandbox), and I expected the executable to go there. – Farmhouse.cabal/bin
oncabal install
, notcabal build
. Andcabal install
with a sandbox installs the executable into the sandbox, so I wouldn't expectcabal build
to touch the sandbox at all. – Paulinepauling