Cabal not installing dependencies when needing profiling libraries?

后端 未结 5 628
暖寄归人
暖寄归人 2020-11-28 06:02

I want to compile my program with profiling, so I run:

$ cabal configure --enable-executable-profiling
...
$ cabal build
...
    Could not find module \'Grap         


        
相关标签:
5条回答
  • 2020-11-28 06:16

    I've enabled library-profiling: True in my ~/.cabal/config file. From then on, any new installations will automatically enable profiling.

    Unfortunately that still means I had to manually reinstall for the old packages already installed. Although, after a while of doing this manually, I now have most packages reinstalled with profiling enabled...

    0 讨论(0)
  • 2020-11-28 06:21

    it appears there is no way right now: Ticket #282 - profiling versions of libraries not managed well "As usual the problem is lack of devevloper time to implement all these nice features we all want."

    0 讨论(0)
  • 2020-11-28 06:33

    From a comment by Tom Lokhorst:

    I do hope someone will come along with a better answer, one that would not require me to reinstall the complete Haskell Platform manually next time.

    For future visitors:

    The task of installing profiling versions of all installed libraries has become less of a chore, cabal (cabal-install) now keeps track of what was installed using it in the world file in the .cabal directory (on linux, that would be $HOME/.cabal, on Windows something like C:\Users\%YOU%\AppData\Roaming\cabal\, on OSX ??).

    So after enabling profiling in the config file (in the same directory), and clearing GHC's package database (you can find the locations of the global and user db per ghc-pkg list nonexisting; remove the cabal-installed packages from the global database with ghc-pkg unregister packagename if you have any, rename or delete the entire user db - this is necessary because the world file only tracks explicitly installed packages, not their dependencies), installing everything with profiling support should work as follows:

    $ cabal install --reinstall world --dry-run
    

    First run with --dry-run to check for problems before actually reinstalling anything. If it would reinstall boot packages like process or directory, that's a bad sign, if you don't know how to handle it, ask on the #haskell IRC channel, one of the mailing lists, or here for guidance. If it fails to find a consistent install plan due to new versions on hackage of some packages which are incompatible with each other, that can usually be solved by editing the world file and constraining allowable versions of some packages.

    Then, if you are optimistic that nothing will badly break,

    $ cabal install --reinstall world
    

    and have a nice pot of tea while GHC is busy compiling.

    0 讨论(0)
  • 2020-11-28 06:35

    Daniel Fischer's answer looks good, but for some reason my ~/.cabal/world library only contained entries for libraries directly installed, and not their dependencies.

    Instead, I dumped out a list of all installed libraries using

    $ ghc-pkg list > list
    

    This lists the libraries installed system-wide and locally. Therefore, I edited the list file to remove the first portion (containing libraries installed system-wide) leaving only the lines after /home/<user>/.ghc/.... Finally, I ran

    $ cabal install --reinstall $(cat list) 
    

    This worked for me. You should maybe do --dry-run first. Then go make a pot of tea. Or bake a cake.

    0 讨论(0)
  • 2020-11-28 06:35

    For visitors 2016+: Just install ghc-prof

    Debian Linux Systems:

    sudo apt-get install ghc-prof

    Arch Linux Systems:

    sudo pacman -S ghc-prof

    0 讨论(0)
提交回复
热议问题