[omniORB] Problem with finding shared libraries

Simon Wright simon@pogner.demon.co.uk
Wed, 11 Aug 1999 06:55:49 +0100


> From: Basma Driss Elkaleh <driss@enst.fr>

> The problem seems that the path of the shared library is not found.
> Could anyone tell me the reason of this? Should I set any variable ?

You can make the linker include the necessary runtime path explicitly
by using -rpath or by setting the LD_RUN_PATH variable. You don't then
need to set LD_LIBRARY_PATH. (NB, there are security-related
restrictions if the program is run as root).

I would recommend you use absolute paths.

Suppose you needed /a/b/lib and /b/c/lib:

  LD_RUN_PATH=/a/b/lib:/b/c/lib; export LD_RUN_PATH
  gcc -L/a/b/lib -L/b/c/lib -lfoo -lbar quux.o 

or

  gcc -Wl,-rpath,/a/b/lib -Wl,-rpath,/b/c/lib -L/a/b/lib \
    -L/b/c/lib -lfoo -lbar quux.o 

Those examples are for GNU/Linux; I seem to remember that Solaris uses
a different option than -rpath.