Skip to content

Improve "Unacceptable argument type in foreign declaration" error message

Using ghc 1ece7b27, zlib fails to build,

$ 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

Codec/Compression/Zlib/Stream.hsc:865:1:
    Unacceptable argument type in foreign declaration: CInt
    When checking declaration:
      foreign import ccall unsafe "static zlib.h inflate" c_inflate
        :: StreamState -> CInt -> IO CInt

Codec/Compression/Zlib/Stream.hsc:865: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 inflate" c_inflate
        :: StreamState -> CInt -> IO CInt

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

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

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

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

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

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

Codec/Compression/Zlib/Stream.hsc:872: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 deflateInit2_" c_deflateInit2_
        :: StreamState
           -> CInt
              -> CInt -> CInt -> CInt -> CInt -> Ptr CChar -> CInt -> IO CInt

Codec/Compression/Zlib/Stream.hsc:884:1:
    Unacceptable argument type in foreign declaration: CInt
    When checking declaration:
      foreign import ccall unsafe "static zlib.h deflate" c_deflate
        :: StreamState -> CInt -> IO CInt

Codec/Compression/Zlib/Stream.hsc:884: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 deflate" c_deflate
        :: StreamState -> CInt -> IO CInt
cabal: Error: some packages failed to install:
zlib-0.5.3.1 failed during the building phase. The exception was:
ExitFailure 1
Trac metadata
Trac field Value
Version 7.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries (other)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Linux
Architecture x86_64 (amd64)
Edited by Ian Lynagh -
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information