Debugging 用堆栈进行仿形
我正在尝试在堆栈中进行评测,这样我就可以获得与RWH上指示的指标相同的指标。我启动了一个新的堆栈项目,如下所示:Debugging 用堆栈进行仿形,debugging,haskell,profiling,haskell-stack,Debugging,Haskell,Profiling,Haskell Stack,我正在尝试在堆栈中进行评测,这样我就可以获得与RWH上指示的指标相同的指标。我启动了一个新的堆栈项目,如下所示: stack new test 然后,如图所示,我运行: 但是,此命令失败,出现以下错误: While constructing the BuildPlan the following exceptions were encountered: -- While attempting to add dependency, Could not find package
stack new test
然后,如图所示,我运行:
但是,此命令失败,出现以下错误:
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
构建构建计划时遇到以下异常:
--在尝试添加依赖项时,
在已知包中找不到包基
--添加依赖项时失败:
基地:需要(>=4.7&&它在lts-6.4
上对我有效。对我来说,这表明你没有安装base的分析版本。这需要在安装GHC时安装。stack exec——哪个GHC
说什么?如果GHC不在你的堆栈根目录中,~/.stack/programs
,那么这意味着你正在使用正在下载自定义GHC安装,该安装可能缺少base的分析版本。若要解决此问题,请执行以下操作之一:
1) 删除自定义安装并运行“堆栈安装”
2) 或者,设置系统ghc:false
并运行“堆栈设置”堆栈安装
相当于堆栈构建--复制存储箱
,因此您应该能够运行
stack build --executable-profiling --library-profiling --ghc-options="-rtsopts"
这将在.stack work/
目录下的某个地方生成一个编译后的可执行文件(stack
将告诉您在哪里)。然后,您应该能够运行它并获得所需的.prof
文件。唯一对我有效的选项是:
stack exec——应用程序的配置文件名--+RTS-p
尝试堆栈构建时会发生什么,我发现,如果您使用上述选项运行stack build
,那么它会将可执行文件编译到.stack work/
下的一个位置,您可以从该位置运行它,而无需安装它。stack build
生成代码时不会出现问题。我忘记添加那个信息了,谢谢!这就解决了问题。我正在使用位于/usr/bin
的ghc
。然后,在使用@Vaibhav建议的标志运行堆栈构建之后,我能够获得分析信息。
stack build --executable-profiling --library-profiling --ghc-options="-rtsopts"