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

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

如何告诉 cabal/ghc 对用户不可见地启用这些运行时标志?我读过--with-rtsopts,但是当我尝试使用它时,GHC (7.0.3) 只是吐出unrecognized flag

最佳答案

标志是-with-rtsopts,而不是--with-rtsopts,所以应该加上-with-rtsopts=-N到 ghc-options 字段。 GHC Flag Reference.

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

https://stackoverflow.com/questions/6505648/

相关文章:

visual-studio-2010 - Visual Studio 解决方案文件 - "Build

c# - Visual Studio 版本中 'Optimize code' 选项的好处

c - 如何链接到 C 中的静态库?

javascript - 如何防止 Visual Studio 2017 构建 JavaScript

c - 如何在 Go 中构建发布版本的二进制文件?

gcc - 在 cmake 中检查 gcc 次要

android - 在 IntelliJ IDEA 中加快 Android 项目构建时间

ios - 创建 CocoaPods 项目的 iOS 模拟器构建

c - getopt.h : Compiling Linux C-Code in Windows

javascript - webpack common chunks 插件 vs webpack d