ldconfig vs LD_LIBRARY_PATH

Roger Oberholtzer roger
Mon May 17 11:33:35 PDT 2004


On Wed, 19 Jun 2002 21:56:39 +1000
James McDonald <james_mcdonald at bigfoot.com> wrote:

> Hi All,
> 
> Just a question on LD_LIBRARY_PATH and ldconfig.
> 
> If you have added the path to a shared library to /etc/ld.so.conf and run 
> ldconfig -v and your shared library shows up in the output from that
> command. Do you still need to define the path in the LD_LIBRARY_PATH env
> var.

Nope. You don't need both.

> I have noticed a lot of packages built from source instruct you to add the
> 
> LD_LIBRARY_PATH env var.
> 
> I'm not too sure on this one...

Either way works. The difference is that a non-root user can set
LD_LIBRARY_PATH, but not change the contents of ldconfig. In addition, as an
environment var, LD_LIBRARY_PATH is rather more temporary than the ldconfig
file. LD_LIBRARY_PATH is great when you only need something defined for a
short time and for the current login, not a permanant new place for all the
system to look at.

And, when compiling, don't forget LD_RUN_PATH. It is your friend and it
eliminates the need for either (if the libraries get installed in one of
the places in LD_RUN_PATH when the app was compiled). 


> 
> Thanks in advance
> 
> -- 
>   James McDonald
>   MCSE (Windows 2000/NT4), CCNA, CCA, MCP + I
>   Registered Linux User #209832
>   http://jamesmcd.dns2go.com (home)
>   Red Hat Linux release 7.2 (Enigma)
>   9:53pm  up 5 days, 23:47, 11 users,  load average: 0.22, 0.17, 0.09
> 
> _______________________________________________
> Linux-users mailing list -
> http://linux-sxs.org/mailman/listinfo/linux-users
> Subscribe/Unsubscribe info, Archives,and Digests are located at the above
> URL.


-- 
+============================+===============================+
| Roger Oberholtzer          |   E-mail:        roger at opq.se |
| OPQ Systems AB             |      WWW:  http://www.opq.se/ |
| Erik Dahlbergsgatan 41-43  |    Phone: Int + 46 8   314223 |
| 115 32 Stockholm           |   Mobile: Int + 46 733 621657 |
| Sweden                     |      Fax: Int + 46 8   302602 |
+============================+===============================+




More information about the Linux-users mailing list