Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 6 Dec 2009 03:27:20 +0200
From:      Dmitry Pryanishnikov <lynx.ripe@gmail.com>
To:        Peter Beckman <beckman@angryox.com>
Cc:        Mark Linimon <linimon@lonesome.com>, Jim Pazarena <fports@paz.bz>, freebsd-ports@freebsd.org
Subject:   Re: sshd on FBSD 8.0-RC2/3
Message-ID:  <754a9c140912051727l50c037bcg92c44fe7cda087f6@mail.gmail.com>
In-Reply-To: <alpine.BSF.2.00.0912031333550.56665@nog.angryox.com>
References:  <4B17D7F3.7080005@gmail.com> <alpine.BSF.2.00.0912031148470.56665@nog.angryox.com> <754a9c140912030913t17c68142u1eec510d73411fef@mail.gmail.com> <alpine.BSF.2.00.0912031333550.56665@nog.angryox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello!

2009/12/3 Peter Beckman <beckman@angryox.com>:
> On Thu, 3 Dec 2009, Dmitry Pryanishnikov wrote:
>
>>  Well, ldd's output _itself_ depends on the current environment and
>> thus can't insure that correct libraries will be used by the
>> application. Compare:
>
>  Well that's just confusing!  So what's the default?  If I have no
>  LD_LIBRARY_PATH set, lighttpd uses /usr/local/lib as I would
>  expect/hope/desire, but I have no understanding as to why.  If I set
>  LD_LIBRARY_PATH to /usr/lib, it uses everything right EXCEPT
>  /usr/lib/libssl.so.6.  What's the logic?  How does one do it right?

  I haven't found definitive answer using RTFM. But luckily it's
opensource, so RTFS gives the following search order for rtld-elf (as
of RELENG_7):

/usr/src/libexec/rtld-elf/rtld.c:

/*
 * Find the library with the given name, and return its full pathname.
 * The returned string is dynamically allocated.  Generates an error
 * message and returns NULL if the library cannot be found.
 *
 * If the second argument is non-NULL, then it refers to an already-
 * loaded shared object, whose library search path will be searched.
 *
 * The search order is:
 *   LD_LIBRARY_PATH
 *   rpath in the referencing file
 *   ldconfig hints
 *   /lib:/usr/lib
 */


>
> web1: 4 : ~/logs/web3 --> unsetenv LD_LIBRARY_PATH
> web1: 4 : ~/logs/web3 --> ldd /usr/local/sbin/lighttpd
> /usr/local/sbin/lighttpd:
>        libpcre.so.0 => /usr/local/lib/libpcre.so.0 (0x80066e000)
>        libssl.so.6 => /usr/local/lib/libssl.so.6 (0x80079e000)
>        libcrypto.so.6 => /usr/local/lib/libcrypto.so.6 (0x8008eb000)
>        libc.so.7 => /lib/libc.so.7 (0x800b63000)
>        libz.so.5 => /lib/libz.so.5 (0x800d9d000)
>        libthr.so.3 => /lib/libthr.so.3 (0x800eb2000)
> web1: 4 : ~/logs/web3 --> setenv LD_LIBRARY_PATH /usr/lib
> web1: 4 : ~/logs/web3 --> ldd /usr/local/sbin/lighttpd
> /usr/local/sbin/lighttpd:
>        libpcre.so.0 => /usr/local/lib/libpcre.so.0 (0x80066e000)
>        libssl.so.6 => /usr/lib/libssl.so.6 (0x80079e000)

 Looks like 'libssl.so.6 => /usr/local/lib/libssl.so.6' is set via
rpath - it overrides standard hints path
'/lib:/usr/lib:/usr/lib/compat:/usr/local/lib...' but still can be
overridden by LD_LIBRARY_PATH.

-- 
Sincerely, Dmitry
nic-hdl: LYNX-RIPE



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?754a9c140912051727l50c037bcg92c44fe7cda087f6>