Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile dependencies for profiling in a cabal sandbox

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 ...

like image 340
mb14 Avatar asked Sep 30 '22 19:09

mb14


1 Answers

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.

like image 74
mb14 Avatar answered Oct 04 '22 03:10

mb14