Cleaning unused libraries and rebuilding dependent ones?

Bruce Simpson bms at
Tue Feb 24 06:06:40 PST 2009

Hi all,

I'm sure that these questions have been asked before, however, a quick 
search of forums on the Web didn't turn up any obvious answers.

I currently use portupgrade on all my FreeBSD installations, however, I 
have noticed over time that a fair amount of detritus can build up in 
${PREFIX}/lib/compat/pkg. So my questions are:-

 1. Is there a tool like Gentoo's revdep-rebuild to force packages 
depending on packaged libraries to be rebuilt?
 2. Is there a more complete tool to clean orphaned libraries like 
'portsclean -L' used to do?

Whilst I greatly appreciate the hard work and effort which the FreeBSD 
ports maintainers put in to ensure shared library versions get bumped 
when needed, this isn't always possible, as it requires keeping a sharp 
eye out for 3rd party software packages which do the wrong thing, and 
don't bump the major(s) when significant semantic changes happen inside 
their libraries, or when the ABI changes.

[1] revdep-rebuild has very similar semantics to what I'm looking for, 
as it will navigate the dependency graph for all packages installed on 
the system, and rebuild packages where dependent libraries have changed.
To do the same with portupgrade alone, I need to know which port(s) 
contain shared libraries, and tell it to go off and rebuild these 
*specific* packages if things change.

[2] 'portsclean -L' used to do something :-) it does not appear to do 
anything now.
I realize I could use libchk to discover which libraries are 
unreferenced at load-time, however, a fair number of the libraries which 
portupgrade moves into ${PREFIX}/lib/compat/pkg can potentially be 
loaded by dlopen() at run-time.
Using libchk's output to remove unreferenced libraries isn't really an 
option without significant post-processing of its output.

I would rather not rely on 'portupgrade -f -a -r', as this is going to 
cause a *lot* of work on the affected systems.

Thanks for any help!

More information about the freebsd-stable mailing list