用阴谋和GHC运行标志建筑 [英] Building with runtime flags using cabal and ghc

查看:94
本文介绍了用阴谋和GHC运行标志建筑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有写在Haskell和打算与GHC编译的程序。该方案的非常好多个内核,因此启用多线程是很重要的。在我的 .cabal 我添加 GHC-选项文件:-O3 -threaded 与螺纹的运行时链接。问题是,这种方法的用户需要运行具有富+ RTS -N 程序,这似乎有点神秘,而不是非常人性化。

I have a program written in Haskell and intended to be compiled with GHC. The program scales very well on multiple cores, so enabling multithreading is very important. In my .cabal file I've added ghc-options: -O3 -threaded to link with the threaded runtime. The problem is that with this approach the user would need to run the program with foo +RTS -N, which seems a bit cryptic and not very user friendly.

我如何知道阴谋集团/ GHC无形地使那些运行标志给用户?我读过有关 - 与-rtsopts ,但GHC(7.0.3)刚刚吐出来的无法识别的标志时我尝试使用它。

How can I tell cabal/ghc to enable those runtime flags invisibly to the user? I've read about --with-rtsopts, but GHC (7.0.3) just spits out unrecognized flag when I try to use it.

推荐答案

该标志是 -with-rtsopts ,而不是 - 与-rtsopts ,所以你应该添加 -with-rtsopts = -N 来的GHC-options字段。 GHC标志参考。

The flag is -with-rtsopts, not --with-rtsopts, so you should add -with-rtsopts=-N to the ghc-options field. GHC Flag Reference.

请注意,这也将要求您加入 -rtsopts 与运行时支持链接到GHC的选项。

Note that this will also require you to link with runtime support by adding -rtsopts to the ghc-options.

这篇关于用阴谋和GHC运行标志建筑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆