[Haskell-cafe] Overriding CPP preprocessor on OSX

Anthony Cowley acowley at seas.upenn.edu
Thu Nov 24 14:46:16 UTC 2016

Cody Goodman writes:

> I'm having some problems[0] with the derive-storable package on OSX I don't
> have on Ubuntu. I would like to use g++ rather than clang to preprocess CPP
> code. Is there a way to do this with cabal?
> Thanks!
> 0: https://github.com/mkloczko/derive-storable/issues/1

You can go a step further and avoid depending on cpp from any of the big C compilers!

Add `hpp` to your `build-depends`, and add this to your .cabal file,

ghc-options: -pgmPhpp

Then if the preprocessor does something untoward, we can actually fix it!

Or you can use the same style of `ghc-options` flag to call gcc's cpp.


More information about the Haskell-Cafe mailing list