[Haskell-cafe] Listing native package requirements based on cabal information

Peter Simons simons at cryp.to
Sat Mar 22 08:56:05 UTC 2014


Hi David,

 > postgresql-libpq clearly depends on the libpq C library (and possibly
 > other things) as listed in the Extra-Libraries field in its cabal
 > file, *as do anything that require postgresql-libpq* which fact does
 > *not* directly show up in their cabal file. Walking the tree and
 > pulling that info is a possibility, but it needs to be done after
 > dependency-resolution in case requirements change version to version.

yes, it's a complicated situation. The information stored in a Cabal
file must be "finalized" before Cabal can use it to install the package.
According to [1], this process depends on the following parameters:

 - Cabal flags chosen by the user,
 - the set of installed (or install-able) packages,
 - the current architecture and operating system,
 - the Haskell compiler used to build the package, and
 - version constraints chosen by the user.

Thus, a given package may depend on an external library 'foo' if you
compile it with GHC 7.6.3, but it depends on 'bar' if you compile it
with GHC 7.4.2, and the same variance occurs recursively in all its
dependencies. It would be nice to know the list of external dependencies
for any given package, but in fact it's not "the list" -- it's many
possible lists, because the outcome depends on the exact environment in
which the package is built.

A rough estimate of these external dependencies is available from Nix,
though. The package postgresql-libpq, for example, has its Hackage home
page at [2]. That page links to the NixOS build information at [3],
which shows the following dependencies:

  acl-2.2.52
  attr-2.4.47
  bash-4.2-p45
  binutils-2.23.1
  coreutils-8.21
  gcc-4.8.2
  gcc-wrapper-4.8.2
  ghc-7.6.3
  glibc-2.18
  gmp-5.1.3
  gnutar-1.27.1
  linux-headers-3.7.1
  ncurses-5.9
  perl-5.16.3
  postgresql-9.2.7
  readline-6.2
  zlib-1.2.8

That list is not be accurate for all environments, but it's a start.

Take care,
Peter


[1] http://hackage.haskell.org/package/Cabal-1.18.1.2/docs/Distribution-PackageDescription-Configuration.html#v:finalizePackageDescription
[2] http://hackage.haskell.org/package/postgresql-libpq
[3] http://hydra.nixos.org/build/9708550#tabs-runtime-deps



More information about the Haskell-Cafe mailing list