[cairo] Could not find libpng in the pkg-config search

Edward Mauthe edward.mauthe201 at myci.csuci.edu
Mon Mar 4 15:11:31 UTC 2019

Hi, I've been trying to build Cairo for GTK3 and have tried to build
versions {1.10.0, 1.14.12, 1.16.0, 1.17.2} and I always get the same
error during ./configure:
"checking for cairo's PNG functions feature...
configure: WARNING: Could not find libpng in the pkg-config search path
checking whether cairo's PNG functions feature could be enabled... no
configure: error: recommended PNG functions feature could not be enabled"

But my pkg-config shows
#pkg-config --list-all | grep libpng
libpng                          libpng - Loads and saves PNG files
libpng16                      libpng - Loads and saves PNG files
as well as I am able to build other libraries that require libpng.

Interestingly enough inside the configure script on line 26,878
#for l in libpng libpng14 libpng12 libpng13 libpng10 libpng10; do
does not list libpng16 but even adding it to this list still keeps the
same error, further pkg-conf has a symbolic entry for libpng which is
listed so I don't see why it not being in the list would cause a

Now there is a fix for this found on the web by using
#export png_REQUIRES="libpng"
and then configuring, to at least get it to configure, but then
actually during compiling I always get a weird error mattering on the
version either being about "pad0" not being a member in an XCB struct
even though I haven't enabled XCB functionality for Cairo or instead
not getting proper linkage to some PNG functions.

More information about the cairo mailing list