[Xquartz-dev] question about libpng in recent X11 packages

Jeremy Huddleston jeremyhu at apple.com
Thu Oct 21 19:07:03 PDT 2010

On Oct 21, 2010, at 17:32, Dave Ray wrote:

> I noticed that recent X11 development releases include both libpng12  
> and libpng14 in /usr/X11/lib.

On Leopard, yes... in /opt/X11/lib on Snow Leopard.

> I think these are conflicting. I was having some difficulties  
> compiling some open source apps, and in debugging, found that I had  
> to completely prune out libpng12 from there.
> libpng14 is backward-compatible with 12

No.  It is *source* compatible, but not *binary* compatible.

> , it is hard for me to understand why there is a reason for both to  
> be present.

For binary compatibility.

> On my system, the following changes improved compiler compatibility:
> cd /usr/X11/lib
> sudo rm libpng.3* libpng12* libpng.la

That's just going to break stuff.

> sudo ln -s libpng14.la libpng.la

libpng14.la and libpng.la should've been the same anyway.  Yeah,  
they're not symlinked, but they have the same contents.

> Comments?

Yeah, you may have solved a small bug in the package you are building  
by breaking many other things...

libpng-1.2 and 1.4 are completely isolated from one another and co- 
exist.  libpng-1.4 is preferred (ie, it is used when just "png" is  
requested without an explicit version):

$ export PKG_CONFIG_PATH="/usr/X11/lib/pkgconfig"
$ pkg-config --libs --cflags libpng12.pc
-I/usr/X11/include/libpng12  -L/usr/X11/lib -lpng12

$ pkg-config --libs --cflags libpng14.pc
-I/usr/X11/include/libpng14  -L/usr/X11/lib -lpng14

$ pkg-config --libs --cflags libpng.pc
-I/usr/X11/include/libpng14  -L/usr/X11/lib -lpng14

You should also have libpng.la and libpng14.la containing identical  
text and:
libpng.dylib -> libpng14.dylib

So in other words, all you accomplished was breaking old applications  
that were linked against libpng-1.2.  Chances are you are building  
something which is explicitly requesting "libpng12" and by making that  
fail, you caused it to fallback on "libpng" which made it get 1.4.

I'd revert those changes and look into what you are building that is  
linking (explicitly) against the version 1.2 library and make it link  
against the 1.4 library instead.


More information about the Xquartz-dev mailing list