On 4/2/2010 6:36 PM, Dr Lou wrote:
> James, thank you for that thought - yes, I was headed to this same test:
> A word first, on the environment: we have several 3rd-party (SunFreeware) and 
> custom-built libs, mostly in /usr/local/lib.  This occasionally leads to what 
> I like to think of as 'white-knuckle computing..."

Yeah, I can definitely understand that.  I now work for a developer of
software that runs on Solaris (as well as other systems), and the
intersection between Solaris practices, our practices, and those of
other vendors with which we must coexist is fraught with peril.

> With crle default path set to: Default Library Path (ELF):   /lib:/usr/lib
> # ldd /usr/sbin/zonecfg
>       - all dependencies are resolved, but ALL in /usr/lib, NONE in 
> /usr/local/lib
> On the other hand, with Default Library Path (ELF):   
> /usr/local/lib:/lib:/usr/lib
> # ldd /usr/sbin/zonecfg
>         libxml2.so.2 =>  /usr/local/lib/libxml2.so.2
>         libxml2.so.2 (SUNW_1.4) =>       (version not found)
>       …
>         libxml2.so.2 (SUNW_1.3) =>       (version not found)
>       ...
>         libxml2.so.2 (SUNW_1.3) =>       (version not found)
>       (occurs twice)

"Don't do that."  Pulling libxml2 from somewhere else is going to be
highly toxic -- not just to zonecfg, but to large parts of the system
that now rely on XML, such as SMF.  I doubt the system can boot that way.

> ldd /usr/local/lib/libxml2.so shows that all dependencies are present - and 
> resolved - but many of them are the libs in /usr/local.  This is no doubt the 
> source of the 'version not found' issue.
> Wondering what is best solution?
> 1) Leave crle with default setting, 
> 2) create a 'custom' crl(environment) for execution of selected binaries?

Here are some solutions, in roughly descending order of what I think is

  1. Use $ORIGIN when building the binaries to begin with.  To do this,
     you'll normally have something like "-L/usr/local/lib" as part of
     the link process.  Use instead '-R$ORIGIN/../lib' -L/usr/local/lib.
     The $ORIGIN token expands to the invocation directory
     (/usr/local/bin) and will work even if the software is installed in
     some other directory.  This is by far the best solution, and works
     on many other systems (though not, I think, AIX).

  2. Use a tool to fix the run paths in the binaries themselves so they
     find the right library directories on their own.  See:


  3. Create a wrapper script (or special launcher program) that sets
     LD_LIBRARY_PATH_{32,64} before running the binaries that need it.
     This is the approach taken by most independent software vendors.
     It's just plain horrible.  The user quickly gets swamped in a sea
     of conflicting paths.  But this is life.

  4. Have the user hack LD_LIBRARY_PATH into his environment.  This is
     what some vendors do.  It's even worse.  It means that the user is
     even less likely to create a good set of paths.

Using crle makes some sense if the path you're adding is at the *END* of
the system paths -- that is, if you have some add-on libraries that do
not conflict with any system library -- and is roughly equivalent to and
slightly better then (4), but it's bad news if you try to override.

You could create a custom LD_CONFIG file, but then you're essentially
doing the same thing as LD_LIBRARY_PATH, and you might as well skip the

James Carlson         42.703N 71.076W         <carls...@workingcode.com>
zones-discuss mailing list

Reply via email to