在对 cabal 进行了一些最近的更改之后,我完全不知道如何分析可执行文件。在~/.cabal/config
中,我启用了分析:
amy@wombat$ grep prof ~/.cabal/config
library-profiling: True
executable-profiling: True
但是,如果我尝试使用分析运行我的可执行文件,我会得到......
amy@wombat$ cabal run realtra-benchmark +RTS -p
cabal: the flag -p requires the program to be built with -prof
cabal:
cabal: Usage: <prog> <args> [+RTS <rtsopts> | -RTS <args>] ... --RTS <args>
<snip>
如果我尝试绕过 cabal,我会得到相同的响应:./dist/dist-sandbox-c8599c64/build/realtra-benchmark/realtra-benchmark +RTS -p
。
当然,在我的 cabal 文件中添加-prof
标志是GHC-Options:
行不通的:
amy@wombat$ cabal build --ghc-options=-Werror && cabal test && cabal install
./realtra.cabal has been changed. Re-configuring with most recently used
options. If this fails, please run configure manually.
Resolving dependencies...
Configuring creatur-realtra-1.0.8...
Warning: 'ghc-options: -prof' is not necessary and will lead to problems when
used on a library. Use the configure flag --enable-library-profiling and/or
--enable-executable-profiling.
我想我不应该添加这些标志,因为它们在我的配置文件中,但以防万一,我尝试一下:
amy@wombat$ cabal configure --enable-executable-profiling --enable-library-profiling
Resolving dependencies...
Configuring creatur-realtra-1.0.8...
amy@wombat$ cabal build --ghc-options=-Werror && cabal test && cabal install
<snip>
amy@wombat$ cabal run realtra-benchmark +RTS -p
cabal: the flag -p requires the program to be built with -prof
cabal:
cabal: Usage: <prog> <args> [+RTS <rtsopts> | -RTS <args>] ... --RTS <args>
<snip>
我错过了什么?