#3400: OS X: ghc broken on Snow Leopard
-------------------------+--------------------------------------------------
    Reporter:  bbb       |        Owner:  chak    
        Type:  bug       |       Status:  reopened
    Priority:  high      |    Milestone:  6.12.1  
   Component:  Compiler  |      Version:  6.11    
    Severity:  blocker   |   Resolution:          
    Keywords:            |   Difficulty:  Unknown 
    Testcase:            |           Os:  MacOS X 
Architecture:  x86       |  
-------------------------+--------------------------------------------------
Changes (by GregoryCollins):

  * status:  closed => reopened
  * resolution:  fixed =>

Comment:

 I don't think that the advice on the mailing list is enough to fix all of
 the issues, which is why you're seeing test failures with FFI. I'm using
 the stock 6.10.4 OSX binary release on Snow Leopard, with the shell script
 wrappers patched to add "-optc-m32 -opta-m32 -optl-m32".

 I can't get zlib to build properly, I keep getting "incompatible zlib
 version" errors. After pounding my head at it for a while, and confirming
 "yes, I'm linking to the correct zlib" and "yes, this is a 32-bit
 executable", I decided to get to the bottom of it. I built a version of
 the C zlib in debugging mode and set a breakpoint on the init function.
 It's failing here (inflate.c line 152):

 {{{
     if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
         stream_size != (int)(sizeof(z_stream)))
         return Z_VERSION_ERROR;
 }}}

 In gdb:

 {{{
 (gdb) print stream_size
 $3 = 112
 (gdb) print sizeof(z_stream)
 $4 = 56
 }}}

 Hmm, that isn't right. Here's the relevant snippet of {{{Stream.hsc}}}:

 {{{
 c_inflateInit2 :: StreamState -> CInt -> IO CInt
 c_inflateInit2 z n =
   withCAString #{const_str ZLIB_VERSION} $ \versionStr ->
     c_inflateInit2_ z n versionStr (#{const sizeof(z_stream)} :: CInt)
 }}}

 Looks like that "sizeof" is being executed in a 64-bit context by hsc2hs;
 I haven't seen this mentioned on the mailing list but I think users also
 need to patch /usr/bin/hsc2hs to read:

 {{{
 exec
 /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/hsc2hs
 $tflag $HSC2HS_EXTRA --cflag="-m32" --lflag="-m32" ${1+"$@"} "$Iflag"
 }}}

 Does the aforementioned patch address this issue?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3400#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to