我正在尝试使Stack中的分析工具生效,以便获得与RWH第25章链接中指示的相同指标。我创建了一个新的Stack项目,如下所示:
stack new test
然后,如此处所示,我运行了:
stack install --executable-profiling --library-profiling --ghc-options="-rtsopts"
然而,该命令失败并出现以下错误:
While constructing the BuildPlan the following exceptions were encountered:
-- While attempting to add dependency,
Could not find package base in known packages
-- Failure when adding dependencies:
base: needed (>=4.7 && <5), stack configuration has no specified version (latest applicable is 4.9.0.0)
needed for package test-0.1.0.0
Recommended action: try adding the following to your extra-deps in /home/damian/test/stack.yaml
- base-4.9.0.0
You may also want to try the 'stack solver' command
我已尝试上述建议,但未成功。
如果我运行
stack build
,程序将会无错误地构建。另外一个问题是,是否不能使用上述标志来运行
stack test
或stack exec
(这似乎比安装可执行文件以进行剖析更合理)。
stack build
时会发生什么? - Vaibhav Sagarstack build
,它会将可执行文件编译到.stack-work/
目录下的一个位置,你可以直接从那里运行它而无需安装。 - Vaibhav Sagarstack build
没有任何问题地构建了代码。我忘记添加那个信息了,谢谢! - Damian Nadales