Solaris如何确定库路径?

时间:2014-11-03 08:32:55

标签: c shared-libraries solaris library-path

在Solaris上,我可以使用crle命令配置库路径,如下所示:

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

我也可以使用传统的LD_LIBRARY_PATH方法,如下所示:

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

Solaris如何确定库路径?例如,Solaris首先选择crle path,然后选择LD_LIBRARY_PATH吗?我尝试google,但无法找到答案。

1 个答案:

答案 0 :(得分:3)

答案在手册中(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.

所以,订单是:

  1. LD_LIBRARY_PATH
  2. 共享对象RPATH
  3. crle默认