简体   繁体   中英

Haskell - GHC error: Could not find module ‘Prelude’/ Perhaps you haven't installed the profiling libraries for package ‘base-4.12.0.0’?

I've just installed haskell-platform from the Ubuntu repositories (it comes with GHC version 8.6.5 ) as instructed by the website . Now, upon trying to compile a program for profiling, using ghc -O2 -prof myCode.hs , I'm met with the following error message:

myCode.hs:1:1: error: 
    Could not find module ‘Prelude’
    Perhaps you haven't installed the profiling libraries for package ‘base-4.12.0.0’?

and similarly for the System.IO module.

Should they not come with the default Haskell instalation? How can I proceed? Perhaps I should purge it all and get Haskell form another source ( Stack , Ghcup , etc? Should it matter?)

I'm fairly new to this, so any help is appreciated.

On Ubuntu, essentially all of the Haskell packages come in bland and -prof flavors. You need the latter for profiling.

ghcup is also fine. There's no need to purge it all -- ghcup and the package manager can coexist cleanly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM