Fwd: How to change -optc-O2 when compiling C files

Roel van Dijk vandijk.roel at gmail.com
Mon Aug 31 15:01:52 EDT 2009

I sent this message to cabal-devel. After reading the cabal website
more carefully I noticed I should sent questions here. Apologies for
the noise in cabal-devel.


I have cabal file which specifies some c-sources to compile together
with the usual Haskell stuff. I noticed that cabal automatically
passes -optc-O2 to GHC when compiling C files. If I specify some
additional cc-options in my cabal file they just get prepended to the
list of options passed to ghc. How do I get rid of the -optc-O2?

With my current cc-options "-D_OPENMP -O3 -funroll-loops" GHC is
invoked like this during a "cabal build":

/usr/bin/ghc -Ilevmar-2.4 -package base- -optc-D_OPENMP
-optc-O3 -optc-funroll-loops -optc-O2 -odir dist/build -c

I don't know which -optc-O? will be picked by the C compiler. Normally
-O2 is ok, but in this case I really want -O3.

Thanks in advance,
Roel van Dijk

More information about the Libraries mailing list