Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

glib gremlin with GHC 7.4

Tags:

haskell

glib

I'm in the process of following this process, tested with GHC 7.2.2 for installing gtk2hs and related kit, but I've hit a little snag. I'm using Mac OS X Lion, glib 2.30.2 installed via homebrew, and ghc 7.4 (the release candidate from just before Christmas). I suppose my gcc version may be relevant

bash-3.2$ gcc --version
i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)

The trouble comes when attempting to install the glib dependency during cabal install gtk. I tried a separate cabal unpack glib and cabal install, and I get this pointer-paranoid complaint.

bash-3.2$ cabal install
Resolving dependencies...
Configuring glib-0.12.2...
Building glib-0.12.2...
Preprocessing library glib-0.12.2...
System/Glib/hsgclosure.c: In function 'gtk2hs_closure_marshal':

System/Glib/hsgclosure.c:110:0:
     warning: passing argument 1 of 'rts_evalIO' from incompatible pointer type

System/Glib/hsgclosure.c:110:0:
     error: void value not ignored as it ought to be

The relevant line of the relevant file is

cap=rts_evalIO(CAP rts_apply(CAP (HaskellObj)runIO_closure, call),&ret);

but I have not the expertise to interpret it.

I've asked the same question in a comment on the reddit discussion which led me to the process in the first place, but I thought I might seek wisdom here too.

Has GHC 7.4 changed the way this sort of thing is done, or is it more likely that something else is broken, earlier in the setup? It is not obviously this problem, but at this level, very little is obvious to me. I don't have a good mental model of what's going on.

I'd be grateful for any light shed.

like image 366
pigworker Avatar asked Feb 04 '26 04:02

pigworker


2 Answers

darcs get http://code.haskell.org/gtk2hs/

from the log:

Thu Jan 19 22:50:06 PST 2012  Duncan Coutts <[email protected]>
  * Fix the type generator for GHC 7.4
  GHC 7.4 is stricter about FFI imports with newtypes, the newtype
  constructor must be visible at the point of import.

Thu Jan 19 22:42:43 PST 2012  Duncan Coutts <[email protected]>
  * Fix cairo for GHC 7.4
  Changes in Num type class

Thu Jan 19 22:40:20 PST 2012  Duncan Coutts <[email protected]>
  * Fix glib for change in RTS API in GHC 7.4
like image 174
mgsloan Avatar answered Feb 06 '26 02:02

mgsloan


Yes, GHC 7.4 has changed some things. rts_evalIO is defined in includes/RtsAPI.h, previously it was

Capability * 
rts_evalIO (Capability *, HaskellObj p, /*out*/HaskellObj *ret);

Now, in 7.4, it is

void rts_evalIO (/* inout */ Capability **,
                 /* in    */ HaskellObj p,
                 /* out */   HaskellObj *ret);

The other rts_eval* functions changed similarly. In short, glib-0.12.2 doesn't build with 7.4. Either hack it yourself to make it compile (highly nontrivial I suspect) or wait and use 7.2.2 until a new glib is released that works with 7.4.

like image 30
Daniel Fischer Avatar answered Feb 06 '26 04:02

Daniel Fischer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!