Chebi
Chebi

Reputation: 141

How do you install profiling libraries in Haskell?

After running

ghc --make -prof -fprof-auto -rtsopts encode.hs

I'm getting this error:

Failed to load interface for ‘Data.Text’
Perhaps you haven't installed the profiling libraries for package ‘text-1.2.5.0’?
Use -v to see a list of the files searched for.

I've tried this:

cabal install -p text --reinstall

As suggested here:

https://downloads.haskell.org/~ghc/9.0.1/docs/html/users_guide/profiling.html

My version of ghc is 8.0.2 so maybe I should be seeing some other documentation though.

Upvotes: 1

Views: 810

Answers (2)

Vishal Sharma
Vishal Sharma

Reputation: 101

If you are using stack then you can do

stack build --profile

Reference: https://github.com/commercialhaskell/stack/issues/2285

Upvotes: 0

Daniel Wagner
Daniel Wagner

Reputation: 153182

One way would be to make a cabal package with an executable whose main-is was encode.hs. That done, you would run

cabal configure --enable-profiling --profiling-detail toplevel-functions

once; subsequent cabal build commands and similar should just do the right thing. One thing worth noting, though, is that some care is required to pass RTS options to the right program when using cabal. The recipe looks like:

cabal run exe:encode -- +RTS ... -RTS

Any +RTS/-RTS blocks that appear before the -- will go to cabal; those after will go to your program.

Upvotes: 3

Related Questions