我正在尝试在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
(这似乎比安装可执行文件来分析它更符合逻辑)。
发布于 2016-06-20 19:53:03
它在lts-6.4
上对我有用。对我来说,这表明您没有安装基本分析版本。这需要在安装GHC时安装。stack exec -- which ghc
怎么说?如果ghc不在您的堆栈根~/.stack/programs
中,那么这意味着您正在使用一个定制的GHC安装,它可能缺少基本的分析版本。要解决以下问题,要么:
1)删除自定义安装并运行“堆栈安装”2)或者设置system-ghc: false
并运行“堆栈安装”
发布于 2016-06-21 04:22:47
stack install
等同于stack build --copy-bins
,所以您应该能够运行
stack build --executable-profiling --library-profiling --ghc-options="-rtsopts"
这将导致编译后的可执行文件位于.stack-work/
目录下的某个位置(stack
会告诉您在哪里)。然后,您应该能够运行它并获得您期望的.prof
文件。
发布于 2018-10-14 16:40:43
对我来说唯一可行的办法是:
stack exec --profile NameOfYourAppGoesHere -- +RTS -p
https://stackoverflow.com/questions/37925828
复制相似问题