[英]Cabal install (Cabal cabal-install) fails due to missing zlib library
我想在 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
錯誤說:
這個問題通常可以通過安裝提供此庫的系統 package 來解決(您可能需要“-dev”版本)。
如何在 Ubuntu 20.04 上安裝此 package?
您的目標是安裝cabal-install
package 。 這個 package 有一個依賴,這里會產生一個問題: zlib
package 。
這個zlib
package 本質上是zlib
C 庫 [wikipedia]的薄包裝。 然而,正如錯誤所說,您沒有安裝zlib
庫,或者至少沒有安裝它的 package 可以使用zlib
庫進行開發。
我們可以通過安裝libghc-zlib-dev
軟件 package來安裝它,例如:
sudo apt-get install libghc-zlib-dev
If we inspect the package details on Debian , we see that essentially this is a package that will install the zlib1g-dev
package, the package to develop software with the zlib
library. 因此,我們可以決定安裝libghc-zlib-dev
或zlib1g-dev
:
sudo apt-get install zlib1g-dev
Nixos 用戶 append pkgs.haskellPackages.zlib
到environment.systemPackages
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.