使用cabal和ghc构建运行时标志

Vik*_*ahl 29 haskell build ghc cabal

我有一个用Haskell编写的程序,打算用GHC编译.该程序在多个内核上可以很好地扩展,因此启用多线程非常重要.在我的.cabal文件中,我添加ghc-options: -O3 -threaded了与线程运行时的链接.问题是,使用这种方法,用户需要运行程序foo +RTS -N,这似乎有点神秘,不是非常用户友好.

如何告诉cabal/ghc为用户隐藏这些运行时标志?我已经读过了--with-rtsopts,但GHC(7.0.3)只是unrecognized flag在我尝试使用时吐出来.

Joh*_*n L 28

标志-with-rtsopts不是--with-rtsopts,因此您应该添加-with-rtsopts=-N到ghc-options字段. GHC标志参考.

请注意,这还需要您通过添加-rtsopts到ghc-options 来链接运行时支持.

  • @Viktor Dahl:事实证明我们只使用了错误的语法.你必须在外面写上"" - with-rtsopts = -N -g1"`和引号.[这是关于Github的相关不满](https://github.com/haskell/cabal/pull/1346). (14认同)
  • 单引号没有解决它,但使用两个`-with-rtsopts`. (7认同)