xmonad / X11

A Haskell binding to the X11 graphics library.

Home Page:http://hackage.haskell.org/package/X11

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

x11 fails to compile

kfiz opened this issue · comments

commented

Hi,
I'm trying to build X11 with cabal, but the installation always fails with:

"Graphics/X11/Xlib/Extras.hsc:1435:47: parse error on input `<-'"

Any suggestions?

Cheers

commented

Sorry, was in a bit of a rush:
I'm trying to build Version 1.6.1.1 on a mac. I'm on ghc 7.6.3.

I haven't the faintest idea. X11-1.6.1.1 builds fine on GHC-7.6.3 here. Could you post the exact cabal command you run and its full output? Bonus points for including a verbose enough run of cabal (add -v, -vv, or -vvv) that we can see the exact command it's invoking when you get that error. Also, what does hsc2hs --version say?

commented

I'm basically just executing a 'caball install x11'. I'm not at my box at the moment, but I'll try to earn those bonus points in a few hours.

commented

Ok, so here some gists:

The first one shows the end of the cabal-install output, before that there' s loads of compilation output.
I pasted in some warnings at the top, that are exemplary for the warnings that were generated.

The second one shows the top,i.e. ./configure ... output.
hsc2hs --version says: hsc2hs version 0.67

Hrm. Those warnings look similar to ones I saw flying by on #haskell the other night; the problem for that person turned out to be that clang's preprocessor behaves differently than gcc's. But since the problem is in a completely different file... I'm still a bit stumped. I'm not even sure what the next thing to ask for would be. Perhaps you could take a peek in the generated Extras.hs file and see what the lines around the one it's complaining about are?

Contacted Eridius on #haskell, who was the guy having CPP problems the other day. He said what worked for him was grabbing the newest cpphs from Hackage and adding --ghc-options="-pgmPcpphs -optP--cpp" to his cabal install command. You could try that, too, I guess.

commented

Downloaded the source to try manually, so I could check the Extras.hs. But that didn't work:
runghc Setup.hs configure --user --prefix=$HOME
runghc Setup.hs install
...
Setup.hs:6:29: Warning:
In the use of `defaultUserHooks'
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless you need Cabal-1.2
compatibility in which case you must stick with defaultUserHooks"
Installing library in /Users/louis/lib/X11-1.6.1.1/ghc-7.6.3
Setup.hs: Error: Could not find module: Graphics.X11 with any suffix: ["hi"]
in the search path: ["dist/build"]
...

After succesfully doing cabal-install cpphs,
cabal install x11 --ghc-options="-pgmPcpphs -optP--cpp" fails with:
...
Building X11-1.6.1.1...
Preprocessing library X11-1.6.1.1...
ghc: could not execute: cpphs
Failed to install X11-1.6.1.1
cabal: Error: some packages failed to install:
X11-1.6.1.1 failed during the building phase. The exception was:
ExitFailure 1

checked with ghc-pkg list wether cpphs was registered, which it was.
I think I`m missing something obvious here...

commented

Ok, the obvious thing was, that cpphs wasn't in my path. :-)
Changing that and switching from gcc-4.8.1 to clang solved the problem.
Should I close the issue?

commented

Thanks by the way for the first-class support!

No, please don't close the issue just yet. I'd like to keep it open until I think of a way of making things Just Work. =)

You're welcome for the help.

It's been six years ... can we close this issue now? It feels like it's no longer a pressing problem.

Well... I'm not spending time thinking about how to fix it. But that doesn't mean it's fixed...