[C2hs] available.h on Mac (bug #6)
duncan.coutts at worc.ox.ac.uk
Wed Jul 23 07:07:13 EDT 2008
On Wed, 2008-07-23 at 00:50 -0500, John Lato wrote:
> I recently ran up against bug #6 on a Mac (Leopard 10.5.2, c2hs
> .15.1). This results in the error
> c2hs: Error in C header file.
> /usr/include/available.h:85: (column 5) [FATAL]
> >>> Lexical error! The character '#' does not fit here.
> I added some information to the bug report based on my
> experimentation, and would like to say that I've found a workaround.
> By running c2hs with these options:
> --cpp=gcc --cppopts=-E --cppopts=-xc
> I was able to successfully build the interface. This works with cabal
> builds as well by passing the options during configure with
> I'm pretty certain that this is due to some sort of failure in Apple's
> cpp and not a problem with c2hs. Can anyone else confirm this?
We've had problems with this before. The current c2hs cpp code uses:
cppopts :: String
cppopts = case os of
-- why is gcc different between all these platforms?
"darwin" -> "-x=c"
"openbsd" -> "-xc"
_ -> "-x c"
So we had previously had reported that using -x=c worked on OSX. Does
that not work for you now?
Ie using: c2hs --cpp=cpp --cppopts=-x=c
or perhaps: c2hs --cpp=cpp --cppopts=-xc
More information about the C2hs