Nan Xiao
Nan Xiao

Reputation: 17477

How does Solaris decide the library path?

On Solaris, I can use crle command to configure library path like this:

crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/local/lib:/opt/DSI/32

I can also use the traditional LD_LIBRARY_PATH method, like this:

LD_LIBRARY_PATH="/export/home/donald/mysql-5.0.91-installed/lib/mysql/:/lib:/usr/lib"

How does Solaris decide the library path? For example, does Solaris select from crle path first, then LD_LIBRARY_PATH? I try to google, but can't find the answers.

Upvotes: 1

Views: 1587

Answers (1)

Useless
Useless

Reputation: 67743

The answer is in the manual (man ld.so.1).

 The runtime linker uses a prescribed search path for  locat-
 ing  the  dynamic  dependencies  of  an  object. The default
 search paths are the runpath recorded in  the  object,  fol-
 lowed  by  a  series  of  defaults.  For 32-bit objects, the
 defaults are /lib followed by /usr/lib. For 64-bit  objects,
 the  defaults  are  /lib/64  followed  by /usr/lib/64. These
 defaults component can be  modified  using  a  configuration
 file  that is created with crle(1). The runpath is specified
 when the dynamic object is constructed using the  -R  option
 to  ld(1).  The  environment variable LD_LIBRARY_PATH can be
 used to indicate  directories  to  be  searched  before  the
 default directories.

So, the order is:

  1. LD_LIBRARY_PATH
  2. shared object RPATH
  3. crle defaults

Upvotes: 3

Related Questions