cabal-dev: installing/running with profiling enabled

Hi all, I want to profile a Haskell program. I have tons of libraries installed without profiling enabled, and some of them are installed with my Linux distribution's package mangaer. So I tried installing the program in a fresh cabal-dev environment with profiling enabled, so that all dependencies would be also installed with profiling enabled. But for some reason even after installing with `cabal-dev install --enable-executable-profiling -prof` I still can't run this program with `caba-dev/bin/program +RTS -p`, it fails with 'program: the flag -p requires the program to be built with -prof'. Can anyone help me on installing/running in cabal-dev with profiling enabled? --- Ömer Sinan Ağacan http://osa1.net

Hi Ömer,
I've replied in-line below.
On Mon, Jul 1, 2013 at 2:34 PM, Ömer Sinan Ağacan
So I tried installing the program in a fresh cabal-dev environment with profiling enabled, so that all dependencies would be also installed with profiling enabled. But for some reason even after installing with `cabal-dev install --enable-executable-profiling -prof` I still can't run this program with `caba-dev/bin/program +RTS -p`, it fails with 'program: the flag -p requires the program to be built with -prof'.
Because you're installing libraries (into the cabal-dev sandbox) you'll also need to add the --enable-library-profiling flag, in addition to the --enable-executable-profiling flag. Cabal-dev could infer the former from the later, but we haven't done that (this doesn't seem to come up very often). I don'th think the -prof flag is necessary; but if it is, then it may also be misinterpreted by cabal-dev; generally, you need to pass flags that only use a single leading "-" to cabal-dev with the --flags=... option. (eg: 'cabal-dev install --enable-library-profiling --enable-executable-profiling --flags=-prof' This command worked for me: $ cabal-dev install --enable-library-profiling --enable-executable-profiling Note that you must remove the existing cabal-dev sandbox directory before running that command (or the installed dependencies that were built without library profiling can cause the build to fail. --Rogan

Hi Rogan, Thanks for your reply.
I don'th think the -prof flag is necessary; but if it is, then it may also be misinterpreted by cabal-dev; generally, you need to pass flags that only use a single leading "-" to cabal-dev with the --flags=... option. (eg: 'cabal-dev install --enable-library-profiling --enable-executable-profiling --flags=-prof'
This command worked for me:
$ cabal-dev install --enable-library-profiling --enable-executable-profiling
OK, so I removed `cabal-dev` directory, and installed again with this command. But it still failed with same error message("the flag -p requires the program to be built with -prof"). Then I also tried removing cabal-dev again and installing again but this time with extra `--flags=-prof` parameter. Failed with same error. Just to be sure I created a new cabal project with only one file: 'Hello.hs' with contents 'main = putStrLn "hello"' and tried to install it with cabal-dev. And `./cabal-dev-/bin/Hello +RTS -p` failed with same error again. Maybe something wrong with my system? My first thought was maybe cabal-dev is using some pre-installed library, and it's not recompiling the whole world for each sandbox. But I don't know how to check this. Any ideas on that? Thanks, --- Ömer Sinan Ağacan http://osa1.net

On Tue, Jul 02, 2013 at 09:07:18AM +0300, Ömer Sinan Ağacan wrote:
OK, so I removed `cabal-dev` directory, and installed again with this command. But it still failed with same error message("the flag -p requires the program to be built with -prof").
Maybe you are running into this: https://github.com/haskell/cabal/issues/1199 Check your version of the Cabal library (cabal --version should tell you). I think this was only broken for a few releases, but I don't remember which ones.

Maybe you are running into this:
https://github.com/haskell/cabal/issues/1199
Check your version of the Cabal library (cabal --version should tell you). I think this was only broken for a few releases, but I don't remember which ones.
Great, it worked. I first updated Cabal library (with `cabal install cabal`) and cabal-install program(`cabal install cabal-install`) and then reinstalled cabal-dev. Now it works for my "hello world" program. Hopefully it will also work with my main program(it's compiling now, and it will take some time). Thanks! --- Ömer Sinan Ağacan http://osa1.net
participants (3)
-
Rogan Creswick
-
Tristan Ravitch
-
Ömer Sinan Ağacan