zlib build error with GHC

前端 未结 5 1061
我寻月下人不归
我寻月下人不归 2021-02-19 10:34

I\'m using a VM with the following configuration:

  • Arch Linux (3.0-ARCH kernel)
  • GHC 7.0.3
  • cabal-install 0.10.2
  • Cabal library 1.10.1.0
相关标签:
5条回答
  • 2021-02-19 10:42

    On Ubuntu, I fixed (or really, avoided) a similar error with

    sudo apt-get install libghc-zlib-dev  libghc-zlib-bindings-dev
    

    (I don't know if both are needed.)

    0 讨论(0)
  • 2021-02-19 10:50

    I don't understand this error, but it happened to me also earlier today while trying to install Agda 2.3 using GHC 7.4. Saizan from #agda suggested that I try

    cabal unpack zlib
    cd zlib-0.5.3.2/
    runghc Setup configure --user; runghc Setup build; runghc Setup install
    

    This proved effective. But I'm still in the dark about what's actually the problem.

    Still, as it worked, I thought I'd share.

    0 讨论(0)
  • 2021-02-19 10:53

    The most likely reason is that the zlib C library headers are missing on your machine. You might instead try to use the Arch Linux "Haskell Platform" or haskell-zlib packages, which resolve C dependencies for you.

    0 讨论(0)
  • 2021-02-19 10:59

    For some reason, the MIN_VERSION_base macro doesn't get expanded, thus the preprocessor sees the condition MIN_VERSION_base(4,4,0) which it of course cannot handle. I've not yet found out why the macro isn't expanded, but workarounds are

    1. install zlib-0.5.3.1 instead
    2. unpack the tarball and edit Codec/Compression/Zlib/Stream.hsc to remove the offending macro (you're using 7.0.3, so your base version is 4.3.1.0, you can replace the macro with 0)

    Edit: After poking around a bit, I found out that to hide these preprocessor directives, which aren't intended for hsc2hs to process, they have to be masked by an extra '#'. Bug report underway.

    0 讨论(0)
  • 2021-02-19 11:01

    I'm still encountering this with the haskell package zlib-0.5.4.2 on GHC 7.8.4. I think the issue is a non-standard location of the library. I solved it by hand-installing zlib 1.2.8 and then doing:

    cabal install zlib --extra-lib-dirs=/usr/local/lib --extra-include-dir=/usr/local/include
    
    0 讨论(0)
提交回复
热议问题