Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building with runtime flags using cabal and ghc

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.

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.

like image 775
Viktor Dahl Avatar asked Jun 28 '11 11:06

Viktor Dahl


1 Answers

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

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

like image 57
John L Avatar answered Sep 28 '22 02:09

John L