Haskell / Stack / Nix build fails, requiring pkg-config >= 0.9.0 and cairo >= 1.2.0, but latest versions are pkg-config 0.29.2 and cairo 1.15.4

Viewed 1929

I'm building a Haskell project using Stack and Nix and depending on the cairo library from Hackage.

When I build the project, I get an error: unable to find pkg-config >= 0.9.0 or cairo >= 1.2.0. However, the latest versions according to their websites are pkg-config 0.29.2 and cairo-1.15.4, and this is reflected in the Nix package manager as well.

On the other hand, there's this article from 2006 announcing the release of Cairo 1.2.0, which further confuses the issue.

Questions

  1. Why are the expected versions so wildly different from the published versions on nixpkgs and the pkg-config / cairo websites?

  2. What advice do you have to get cairo to build on macOS (best case scenario: using Nix for system packages and Stack for Haskell packages)

Steps to reproduce:

> stack new cairo-test simple && cd cairo-test

# Now, to get Cairo
> stack install cairo

cairo-0.13.3.1: configure ...
Process exited with code: ExitFailure 1
Configuring cairo-0.13.3.1...
setup: The program 'pkg-config' version >=0.9.0 is required but it could not be found.

# This version doesn't seem to exist (not on the pkg-config website, either).
> nix-env -qaP pkg-config
nixpkgs.pkgconfig          pkg-config-0.29.2
nixpkgs.pkgconfigUpstream  pkg-config-0.29.2

# However, if installed, a new error:
> nix-env -i pkg-config
installing ‘pkg-config-0.29.2’
building path(s) ‘/nix/store/m4ks2si7b78757c1rc43r0833pxkvjb3-user-environment’
created 102 symlinks in user environment
> stack install cairo
setup: The pkg-config package 'cairo' version >=1.2.0 is required but 
it could not be found.

# Again, this version doesn't seem to exist, either on the site on in `nixpkgs`
> nix-env -qaP cairo
nixpkgs.cairo  cairo-1.14.8

# Installing it anyway, to see what the next error is
> nix-env -i cairo
installing ‘cairo-1.14.8’
building path(s) ‘/nix/store/dcx0in96wcd7yd8q71y93jd5306vag8g-user-environment’
created 112 symlinks in user environment

# Get the same version error now that Cairo is installed
setup: The pkg-config package 'cairo' version >=1.2.0 is required but it could not be found.
2 Answers
Related