Skip to content

Build failure on OS X 10.9 (presumably due to clang's CPP) #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Blaisorblade opened this issue May 5, 2014 · 4 comments
Open

Build failure on OS X 10.9 (presumably due to clang's CPP) #14

Blaisorblade opened this issue May 5, 2014 · 4 comments
Assignees
Labels
Milestone

Comments

@Blaisorblade
Copy link

Hi, thanks for this package!

But cabal install numerals does not work here, I need a small patch to the sources. Can you incorporate that into a new release? I'd like to distribute a package depending on numerals, and I can't fix numerals on every machine where I need it.

When trying to install numerals (latest version, 0.4), I get:

$ cabal build
Package has never been configured. Configuring with default flags. If this
fails, please run configure manually.
Resolving dependencies...
Configuring numerals-0.4...
Building numerals-0.4...
Preprocessing library numerals-0.4...

src/Text/Numeral/Exp/Reified.hs:6:4:
     error: invalid preprocessing directive
      #-}
       ^
1 error generated.
[ FIX THIS ]
pgiarrusso [BlueVelvet: ~/Documents/Research/Paolo/tools/numerals-0.4: 00:50: 6 (0)]
$ cabal build
Building numerals-0.4...
Preprocessing library numerals-0.4...

src/Text/Numeral/Misc.hs:6:4:
     error: invalid preprocessing directive
      #-}
       ^
1 error generated.

This is the fix which works for me:

diff -ru numerals-0.4/src/Text/Numeral/Exp/Reified.hs numerals-0.4-/src/Text/Numeral/Exp/Reified.hs
--- numerals-0.4/src/Text/Numeral/Exp/Reified.hs    2014-05-06 00:52:44.000000000 +0200
+++ numerals-0.4-/src/Text/Numeral/Exp/Reified.hs   2014-05-06 00:50:21.000000000 +0200
@@ -2,8 +2,7 @@
            , NoImplicitPrelude
            , PackageImports
            , TypeFamilies
-           , UnicodeSyntax
-  #-}
+           , UnicodeSyntax #-}

 module Text.Numeral.Exp.Reified ( Exp(..), showExp, Side(L, R) ) where

Only in numerals-0.4-/src/Text/Numeral/Exp: Reified.hs~
diff -ru numerals-0.4/src/Text/Numeral/Misc.hs numerals-0.4-/src/Text/Numeral/Misc.hs
--- numerals-0.4/src/Text/Numeral/Misc.hs   2014-05-06 00:52:44.000000000 +0200
+++ numerals-0.4-/src/Text/Numeral/Misc.hs  2014-05-06 00:50:44.000000000 +0200
@@ -2,8 +2,7 @@
            , MagicHash
            , NoImplicitPrelude
            , PackageImports
-           , UnicodeSyntax
-  #-}
+           , UnicodeSyntax #-}

 module Text.Numeral.Misc where

This is on Mac OS X 10.9.2, where cpp is provided by default by clang (I'm guessing):

$ cpp --version
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

I just installed the Apple Developer Tools, nothing fancy here.

I don't know for sure what I should actually check to pinpoint this to clang, and I might be wrong on that — it's just an educated guess. If you cannot reproduce the problem or have issues with the fix, I can investigate more on my system if you have pointers.

Cheers,
Paolo

@roelvandijk
Copy link
Owner

Hi Paolo,

How nice that you are using this package!

This is indeed a bug somewhere in GHC. But the workaround is easy as you mentioned. I now use a different style for the language pragmas that avoids this problem. Instead of

{-# LANGUAGE OptionA
           , OptionB
           , OptionC
#-}

I use

{-# LANGUAGE OptionA #-}
{-# LANGUAGE OptionB #-}
{-# LANGUAGE OptionC #-}

I will fix this as soon as possible. Unfortunately that is probably this Friday or Saturday. Also note that there are some API changes between version 0.4 and the git head version.

@roelvandijk roelvandijk added this to the 0.5 milestone May 7, 2014
@roelvandijk roelvandijk self-assigned this May 7, 2014
@Blaisorblade
Copy link
Author

Thanks!

Also note that there are some API changes between version 0.4 and the git head version.

I'm planning to use it, so I can just as well learn the new API.
A fixed version of the old one might be nice for some people, but I'm fine either way. Also, I need really basic functionality (just numbers for English).

@Blaisorblade
Copy link
Author

FYI: I just learned that the problems with clang can be avoided somewhat simply:

https://gist.github.com/tibbe/8448715

This allowed me to install numerals successfully.

@roelvandijk
Copy link
Owner

That is great to hear.

I haven't had any time to spend on this problem. Luckily there is a hackaton in 2 weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants