I am trying to build a profilable executable with stack build --profile. stack build, stack test, and stack ghci all work correctly. (Full repo for reference)
I get many errors like the following:
StateVar > Could not find module ‘Prelude’
StateVar > Perhaps you haven't installed the profiling libraries for package ‘base-4.15.1.0’?
StateVar > Use -v (or `:set -v` in ghci) to see a list of the files searched for.
StateVar > |
StateVar > 72 | module Data.StateVar
This kind of makes sense to me - I'm using the GHC installed by stack, and when installing it didn't give me any indication that it was using profiling libraries.
> stack exec -- which ghc
/home/xavier/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/bin/ghc
I'm using lts-19.2.
Problems with this command seem to be relatively common in other questions, but usually the response is "stop using system GHC". Things I have tried that haven't worked:
setup, but found no reference to profiling.--profile, but finding no reference to system profiling libraries.stack cleanrm -Rf ~/.stack/programssudo apt install ghc-prof and then stack build --system-ghc --profile (on a lark ... would prefer to stick to stack managed GHC...)Thanks to sjakobi in the comments, this issue is most likely caused by a packaging error in GHC 9.0.2 (and 9.2.2 by the looks of it).
Downgrading to lts-18.28 (GHC 8.10.7) fixed the issue and allowed me to profile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With