chris@cubby ~ ❯❯❯ nix run -f '<nixpkgs>' zlib -c cabal install zlib Resolving dependencies... Configuring zlib-0.6.2... Failed to install zlib-0.6.2 Build log ( /home/chris/.cabal/logs/ghc-8.2.2/zlib-0.6.2-L2Qec9Buml21zwTs2VzSGb.log ): cabal: Entering directory '/tmp/cabal-tmp-31070/zlib-0.6.2' Configuring zlib-0.6.2... cabal: Missing dependency on a foreign library: * Missing (or bad) header file: zlib.h * Missing 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 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: Leaving directory '/tmp/cabal-tmp-31070/zlib-0.6.2' cabal: Error: some packages failed to install: zlib-0.6.2-L2Qec9Buml21zwTs2VzSGb failed during the configure step. The exception was: ExitFailure 1
The requirement of
zlib.h is declared here: https://github.com/haskell/zlib/blob/964a80a5451f4dd4244f9a86221fe2b4cb4bff2a/zlib.cabal#L74
The doc for the
includes attibute https://www.haskell.org/cabal/users-guide/developing-packages.html#pkg-field-includes
A list of header files to be included in any compilations via C. This field applies to both header files that are already installed on the system and to those coming with the package to be installed. The former files should be found in absolute paths, while the latter files should be found in paths relative to the top of the source tree or relative to one of the directories listed in
However, the Cabal documentation (this part, at least) neglects to mention what "absolute paths" the files are to be "found" in, so I am now stuck.