Subject: Re: Correct way to find shareable libraries?

From: [email-masked] (Casper H.S. Dik)
Date: 9 Feb 1994 09:08:40 GMT

[email-masked] (Obi Thomas) writes:

>Suppose I have a shareable library, /opt/foo/libfoo.so. Which of these is
>the "correct" way to link with it?

>	ld foo.o -o foo -R/opt/foo -lfoo
>	ld foo.o -o foo -L/opt/foo -lfoo
>	LD_LIBRARY_PATH=/opt/foo ld foo.o -o foo -lfoo
>	LD_RUN_PATH=/opt/foo ld foo.o -o foo -lfoo

None of the above:

	ld foo.o -o foo -L/opt/foo -R/opt/foo -lfoo

which is equivalent to:

	LD_RUN_PATH=/opt/foo  LD_LIBRARY_PATH=/opt/foo ld foo.o -o foo -lfoo

(btw, you should use your compiler (cc, pc) to link , rather than ld)

>If I specify LD_RUN_PATH or -R, do I "lock in" that location for the
>library? In other words, suppose I send my shareable binary to a friend
>who prefers ~/lib/libfoo.so. Will using -R/opt/foo to build the executable
>prevent my friend from running it?

In that case he'll need to set LD_LIBRARY_PATH before running foo.

(now where is that utility that lets you change the build in library path.

Casper