Cabal install (Cabal cabal-install) 由于缺少 zlib 库而失败

问题描述

我想在 Ubuntu 20.04 上安装 Cabal 3.4.0.0。

$ sudo apt install cabal-install
$ cabal --version
cabal-install version 2.4.0.0

$ sudo cabal update
$ sudo cabal install Cabal cabal-install
...
Starting     zlib-0.6.2.3
Failed to install zlib-0.6.2.3
Build log ( /root/.cabal/logs/ghc-8.6.5/zlib-0.6.2.3-93Wbo8gIIzI9bg4p2MsNUF.log ):
cabal: Entering directory '/tmp/cabal-tmp-126381/zlib-0.6.2.3'
Configuring zlib-0.6.2.3...
cabal: Missing dependency on a foreign library:
* Missing (or bad) header file: zlib.h
* Missing (or bad) C library: z
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.If the
library file does exist,it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
If the header file does exist,it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
...
cabal: Error: some packages Failed to install:
cabal-install-3.4.0.0-3glzV3hM64DLoOfz3dHKsn depends on cabal-install-3.4.0.0
which Failed to install.
hackage-security-0.6.0.1-KiAyVYLxooJAP3ckeQHnBD depends on
hackage-security-0.6.0.1 which Failed to install.
zlib-0.6.2.3-93Wbo8gIIzI9bg4p2MsNUF Failed during the configure step. The
exception was:
ExitFailure 1

错误说:

这个问题通常可以通过安装系统包来解决 提供此库(您可能需要“-dev”版本)。

如何在 Ubuntu 20.04 上安装此软件包?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)