How to check applications vs. libraries

Mel fbsd.questions at
Wed Oct 3 05:25:50 PDT 2007

On Tuesday 02 October 2007 22:53:20 RW wrote:
> On Tue, 2 Oct 2007 19:23:29 +0200
> Daniel Tourde <daniel.tourde at> wrote:
> > I am used to install FreeBSD applications by using the port
> > collection. I also update regularly (twice a month or something) the
> > apps, using 'portupgrade -a -N' on a refreshed port collection.
> >
> > Here are my questions:
> > - How can I check that the apps that have been build with certain
> > libraries still work when some of the libs have been updated?
> > - Is it possible then to rebuild the selected set of apps that have
> > been 'corrupted' by the library upgrade (classicaly from liba.1 to
> > liba.2)? If yes, how?
> Generally this doesn't cause a problem as when portupgrade upgrades a
> library through a major revision, it puts a copy of the old library
> into a compatibility directory.

True. /usr/local/lib/compat/pkg

> Applications that depend on updated libraries get version-bumped when
> the library major version gets changed

Not true. Only direct dependants get version bumped and not consistently 
either. To recompile all dependants against the latest version of a library, 
one has to find out which port the older version in /usr/local/lib/compat/pkg 
belongs to and forcibly upgrade all deps of that package, using 
`portupgrade -fr'.

I use the following little php script to identify programs/libraries still 
using old libs:
#!/usr/local/bin/php -q
// vim: ts=4 sw=4 noet ai tw=78
$localbase = getenv('LOCALBASE');
$cmd_fmt = '/usr/bin/ldd %s 2>/dev/null| grep compat/pkg';
$search_paths = array('bin', 'sbin', 'lib', 'libexec');
foreach($search_paths AS $path)
    echo("==> $path\n");
    $files = glob("$path/*");
    foreach($files AS $file)
        $check = shell_exec(sprintf($cmd_fmt, $file));
        if( empty($check) )
        // pretty print reformat
        $check = preg_replace('/^.*?=>/m', "\t\t=>", $check);
        echo("\t$file depends on:\n$check");

Given time, I could probably come up with something fully automated, but in 
practice, it boils down to 2 or 3 libraries, usually of the sort gettext, 
expat, vorbis, xml/xslt.
It's not full-proof, because some paths aren't searched, for 
example /usr/local/openoffice, just adjust the search_paths array if you need 

More information about the freebsd-questions mailing list