How to change -optc-O2 when compiling C files

Roel van Dijk vandijk.roel at
Mon Aug 31 04:28:53 EDT 2009


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 cabal-devel mailing list