Subject: linking with wrong zlib on MacOS X?
To: None <tech-pkg@NetBSD.org>
From: John D. Baker <jdbaker@mylinuxisp.com>
List: tech-pkg
Date: 10/24/2005 00:24:30
While updating a number of packages on MacOS X 10.4.2, I noticed that
many if not most (all?) of the packages that depend on devel/zlib are
actually linking against /usr/lib/libz.<ver>.dylib instead of the one
installed in /usr/pkg/lib/libz.<ver>.dylib.

These packages were originally built under MacOS X 10.3.9, but I recently
upgraded the machine to Tiger.

I first noticed this in some packages whose configure script reports
where it found some of its required libraries.  The package otherwise
builds and installs OK, but the linker will complain at runtime about
about not loading zlib because another library (say libpng) requires
a later version (2.0.0), but the linker is only finding v1.0.0 (the
version supplied with MacOS X).

Rebuilding/reinstalling the offending library(ies) eliminates the problem,
but now everything is linked against the system zlib instead of the one
built from pkgsrc.

See also: pkg/30645.

Isn't libtool supposed to 'guide' the selection between multiple
versions of libraries?  Or is it only among multiple pkgsrc-installed
versions, but not taking incumbent versions into account on non-NetBSD
systems?

I suppose it will take careful scrutiny of package binaries to find those
that are linking against incumbent versions of libraries instead of the
pkgsrc-derived ones, and develop patches for their config scripts to force
selection of the pkgsrc version?

(I also see this with libiconv.)

-- 
John D. Baker, KN5UKS                    NetBSD     Darwin/MacOS X
jdbaker(at)mylinuxisp(dot)com                 OpenBSD            FreeBSD
BSD -- It just sits there and _works_!