用堆栈分析 [英] Profiling with Stack
问题描述
我正在尝试在Stack中进行概要分析,以便获得与第25 章。我开始了一个新的Stack项目,如下所示:
I'm trying to get profiling working in Stack, so that I can get the same metrics as the one indicated on Chapter 25 of RWH. I started a new Stack project, as follows:
stack new test
然后,如所示这里我运行了:
Then, as indicated here I ran:
stack install --executable-profiling --library-profiling --ghc-options="-rtsopts"
但是此命令失败,并出现以下错误:
However this command fails with the following error:
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
我尝试了上面的建议,没有成功。
I've tried the recommendations above, without success.
如果我运行 stack build
,
还有一个问题,我想知道是否无法运行 stack test
或带有上述标志的 stack exec
(这似乎比安装可执行文件以进行分析更合乎逻辑)。
As an additional question, I wonder whether is not possible to run stack test
or stack exec
with the flags above (this seems more logical than installing a the executable in order to profile it).
推荐答案
它适用于 lts-6.4
。对我来说,这表明您没有安装基本配置文件的版本。在安装GHC时,需要进行安装。 stack exec是什么-ghc
说什么?如果ghc不在您的堆栈根目录〜/ .stack / programs
中,则意味着您使用的是自定义GHC安装,该安装可能缺少配置文件版本基地。要解决该问题,请:
It works for me on lts-6.4
. To me, this indicates that you don't have a profiling version of base installed. This would need to get installed when installing GHC. What does stack exec -- which ghc
say? If ghc isn't located in your stack root, ~/.stack/programs
, then this means that you're using a custom GHC install, which may lack a profiling version of base. To resolve, either:
1)删除自定义安装并运行堆栈设置
2)或者,设置 system-ghc: false
并运行堆栈设置
1) Remove custom install and run "stack setup"
2) Alternatively, set system-ghc: false
and run "stack setup"
这篇关于用堆栈分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!