[Haskell-cafe] zlib build failure on recent GHC

Ben Gamari bgamari.foss at gmail.com
Mon Nov 7 16:53:34 CET 2011


With GHC 1ece7b27a11c6947f0ae3a11703e22b7065a6b6c zlib fails to build,
apparently due to Safe Haskell (bug 5610 [1]). The error is specifically,

$ cabal install zlib
Resolving dependencies...
Configuring zlib-0.5.3.1...
Preprocessing library zlib-0.5.3.1...
Building zlib-0.5.3.1...
[1 of 5] Compiling Codec.Compression.Zlib.Stream ( dist/build/Codec/Compression/Zlib/Stream.hs, dist/build/Codec/Compression/Zlib/Stream.o )

Codec/Compression/Zlib/Stream.hsc:857:1:
    Unacceptable argument type in foreign declaration: CInt
    When checking declaration:
      foreign import ccall unsafe "static zlib.h inflateInit2_" c_inflateInit2_
        :: StreamState -> CInt -> Ptr CChar -> CInt -> IO CInt

Codec/Compression/Zlib/Stream.hsc:857:1:
    Unacceptable argument type in foreign declaration: CInt
    When checking declaration:
      foreign import ccall unsafe "static zlib.h inflateInit2_" c_inflateInit2_
        :: StreamState -> CInt -> Ptr CChar -> CInt -> IO CInt

Codec/Compression/Zlib/Stream.hsc:857:1:
    Unacceptable result type in foreign declaration: IO CInt
    Safe Haskell is on, all FFI imports must be in the IO monad
    When checking declaration:
      foreign import ccall unsafe "static zlib.h inflateInit2_" c_inflateInit2_
        :: StreamState -> CInt -> Ptr CChar -> CInt -> IO CInt
...

This is a little strange since,

  a) It's not clear why Safe Haskell is enabled
  b) The declarations in question seem to be valid

Does this seem like a compiler issue to you?

Cheers,

- Ben

[1] http://hackage.haskell.org/trac/ghc/ticket/5610



More information about the Haskell-Cafe mailing list