我正在尝试用stack build --profile
构建一个可评测的可执行文件。stack build
、stack test
和stack ghci
都能正常工作。(完整回购供参考(
我得到了很多错误,如下所示:
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
这对我来说是有意义的——我使用的是按堆栈安装的GHC,在安装时,它没有给我任何指示,表明它使用的是评测库。
> stack exec -- which ghc
/home/xavier/.stack/programs/x86_64-linux/ghc-tinfo6-9.0.2/bin/ghc
我用的是lts-19.2
。
这个命令的问题似乎在其他问题中相对常见,但通常的回答是";停止使用系统GHC";。我尝试过但没有成功的东西:
- 正在读取
setup
的堆栈文档,但未发现对评测的引用 - 正在读取
--profile
的堆栈文档,但未找到对系统评测库的引用 stack clean
rm -Rf ~/.stack/programs
sudo apt install ghc-prof
,然后是stack build --system-ghc --profile
(开玩笑……更愿意坚持堆栈管理的GHC…(
由于评论中的sjakobi,这个问题很可能是由GHC 9.0.2中的包装错误引起的(从外观上看是9.2.2(。
降级到lts-18.28
(GHC 8.10.7(解决了这个问题,并允许我进行简介。