5

I'm trying to compile one of my executables with profiling options. I added the -prof options in my cabal file. When I do that, I get a message saying

Could not find module ‘Package-X’
Perhaps you haven't installed the profiling libraries for package ‘package-x’?
Use -v to see a list of the files searched for.

How do I do that? I tried cabal install --only-dependency --reinstall and I get the following response :

All the requested packages are already installed:
Use --reinstall if you want to reinstall anyway.

I already used --reinstall what should I do ? I also tried cabal configure --enable-profiling-libraries etc ...

bheklilr
  • 53,530
  • 6
  • 107
  • 163
mb14
  • 22,276
  • 7
  • 60
  • 102
  • Does [this](http://stackoverflow.com/questions/1704421/cabal-not-installing-dependencies-when-needing-profiling-libraries) question solve your problem? – bheklilr Sep 24 '14 at 16:40
  • It kind of solve it. `cabal install --reinstall world` did something. But I still can't get the profiling to be on for my executable. If I add `-prof` in the cabal file, it complains it's not needed. If I remove it `+RTS -p` complaining the binary hasn't been compiled with profiling support ... – mb14 Sep 24 '14 at 19:13
  • Did you add `library-profiling: True` to your `.cabal/config` file? That seemed to be the real trick for getting libraries with profiling to be installed. – bheklilr Sep 24 '14 at 19:16
  • No I didn't. I thought `cabal configure --enable-library-profiling` would do the trick. However, my problem might be that I'm using different sandbox sources ... I'm trying to recompile them – mb14 Sep 24 '14 at 19:40
  • Setting `library-profiling` to `True` in the `.cabal/config` file did the trick. But I had to delete the sandbox (`cabal sandbox delete; cabal sandbox init; cabal sandbox install`). Which reinstalled everything (normal+profiled libraries). I would have prefered to avoid reinstalling the normal one. – mb14 Sep 25 '14 at 08:53

1 Answers1

4

The link suggested by bheklilr helped but didn't straight away.

I ended up adding library-profiling: True in my .cabal/config file and reinstall everything. cabal install --reinstall wolrd didn't work, maybe because I'm inside a sandbox. However, the good things about sandboxes is that you can ditch them away so I reinstalled everything using

cabal sandbox delete
cabal sandbox init
cabal install

Even though this solution worked, it's not satisfactory for the following reasons :

  • I had to modify .cabal/config which is a global file, whereas in a ideal wolrd I should have had to only modify my sandbox. However, I didn't try to create a local cabal config file

  • I had to reinstall EVERYTHING, ie the profiling version of each library as well as the plain version, which was already installed.

Community
  • 1
  • 1
mb14
  • 22,276
  • 7
  • 60
  • 102
  • According to the documentation (https://www.haskell.org/cabal/users-guide/installing-packages.html#developing-with-sandboxes), you can set up project-local config files by creating a file called `cabal.config` in the same directory as your `cabal.sandbox.config`. This should allow you to set the `library-profiling: True` option for your sandbox. – Stephan Feb 10 '15 at 13:16