Shared libs on Solaris (was: Re: [Exim] LD/Exim errors)

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Jim Knoble
Fecha:  
A: Exim Users
Temas antiguos: Re: [Exim] LD/Exim errors
Asunto: Shared libs on Solaris (was: Re: [Exim] LD/Exim errors)
Circa 2001-Nov-13 22:11:48 -0800 dixit Gary Ferrer:

: No I haven't. ldconfig doesn't exist on Solaris nor does ld.so.conf
: (I think that's a linux thing). I don't know what the equivalent is
: for Solaris. I'm having difficulty getting my head around how the
: Solaris ld libraries work but I'm working on it.

Solaris doesn't really have an equivalent to ldconfig or /etc/ld.so.conf.
There are two ways for a program to find its dynamic libraries under
Solaris (and similar OSes):

  (1) The Easy Way:  Set the 'LD_RUN_PATH' environment variable to the
      colon-separated list of directories in which the runtime linker
      should look for shared libraries.  This isn't really so easy:


        (a) Different binaries often need different (sometimes even
            conflicting) LD_RUN_PATHs.


        (b) LD_RUN_PATH doesn't (or at least shouldn't) work for setuid
            binaries.


  (2) The Right Way(TM): When linking the program, use the '-R <path>'
      switch to specify each directory in which the runtime linker
      should look for shared libraries.  If done right, this actually
      turns out to be easier than The Easy Way, if you have control of
      the linking stage of the binary, for several reasons:


        (a) Since it's specific to each binary, using -R at linktime
            doesn't create conflicts for other binaries or create a
            system administration nightmare.


        (b) According to the ld(1) man page, -R supersedes LD_RUN_PATH,
            so if it was specified at all by whoever linked the binary,
            then LD_RUN_PATH won't work.


        (c) Works for setuid binaries in addition to the less
        aristocratic variety.


If you're building software for a single system, your "runpath" can
probably be the same as your library path; that is, use the same paths
with -R as you do with -L at linktime.

If you're building software for use on more than one system, and
especially if you're building it for use by someone other than
yourself, you should pick the runpath rather carefully. For many
binaries, this is a sufficient runpath:

-R /usr/local/lib -R /usr/lib -R /lib

For newer Solarises (Solares?), this might be better:

-R /space/local/lib -R /opt/lib -R /usr/lib -R /lib

Software that requires CDE or BrokenWindows gets a bit more complicated.

Good luck.

--
jim knoble | jmknoble@??? | http://www.pobox.com/~jmknoble/
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)