Closed bergmark closed 10 years ago
Yeah this is a known issue. The problem is that different C preprocessors accept different syntax for token pasting. I don't think there's any way to do it that's completely portable.
In fact type-eq
is not even supposed to use the system preprocessor (if that ever works I'm surprised) but cpphs
.
...and here I was going to wonder why that's not happening, but it seems that it's not actually in the cabal file! I'm sure I had it in there at one point. Anyway, maybe I should fix that then.
You can force cabal to use cpphs when building by supplying ghc-options: -cpp -pgmPcpphs -optP--cpp
in the cabal file. This works for me on mountain lion (it also works on ML without this), but fails on mavericks with
Type/Eq.hs:1:1:
File name does not match module name:
Saw: `Main'
Expected: `Type.Eq'
not sure why maybe the macro is outputting something before the module header?
That's doubly weird, if it's using cpphs in each case then why would it have different results?
Could you perhaps try to get the preprocessed output it's using and send it to me? (I'd do it myself, but I don't have access to a Mac.)
Sure, I can check when I get to the office tomorrow.
ghc-options: -pgmPcpphs -optP--cpp
this works for me, os x 10.9 xcode 5! thanks!
@DavidFeng your example differs from the earlier one only in that it's missing the -cpp
from the beginning, is that intentional?
I'll gladly add whichever line to the cabal file once it's clear that it solves the problem.
@glaebhoerl
I have used this method to fix the cpp problem
justtesting.org/post/64947952690/the-glasgow-haskell-compiler-ghc-on-os-x-10-9
with or without -cpp, I can build this package. ps: -cpp have been deprecated
Warning: Instead of 'ghc-options: -cpp' use 'extensions: CPP'
Thanks @mbrock!
This fixes the problem for us. It also adds cpphs under build-tools
. @DavidFeng can you please verify that it still works for you?
I've merged the pull request, thanks @mbrock! I'll publish to Hackage once we get confirmation from @DavidFeng that the fix works on his end as well.
No word from him in over 24h, so I've gone ahead and published it. Hope it works. Please reopen if it doesn't.
And thanks everyone for the help.
There seems to be problems with macro expansion using clang on OS X Mavericks, see this stackoverflow post https://stackoverflow.com/questions/20785260/cant-install-fay-on-mac-os-x-mavericks/20801824
The suggested fix there is to wipe the haskell-platform installation and compile it using homebrew and switching it to use gcc rather than clang.
This is a bit inconvenient and will probably trip up users. Is there anything that can be done about it?
Cheers