Re: loading shared library.
From: Michael C. Shultz (ringworm_at_inbox.lv)
Date: Tue, 15 Jun 2004 20:16:41 GMT
On Tue, 15 Jun 2004 11:52:39 +0900, JaSeong Ju wrote:
> I have a question about loading shared library.
> I created a shared library, say, libFoo.so and an executable
> "my_program". I installed
> my_program in /usr/local/myprog/bin and libFoo.so in /usr/local/myprog/lib.
> I would like "my_program" to load libFoo.so at runtime but it does not work.
> When I issue command
> $ldd my_program
> libFoo.so => not found
> libXm.so.3 => /usr/X11R6/lib/libXm.so.3 (0x4003a000)
> libc.so.6 => /lib/tls/libc.so.6 (0x42000000)
> libdl.so.2 => /lib/libdl.so.2 (0x4040e000)
> When I try to run:
> $ ./my_program
> $ ./my_program: error while loading shared libraries: libFoo.so: cannot
> open shared object file: No such file or directory
> I can solve this problem by setting the environment variable
> $export LD_LIBRARY_PATH=/usr/local/myprog/lib:$LD_LIBRARY_PATH
> then "my_program" runs fine.
> However, I don't want to depend on LD_LIBRARY_PATH and prefer not to set
> environment variable.
> I don't want to use ldconfig either.
> Is there any other solution?
Why not put the library file into /usr/local/lib? Then either run
ldconf -m or simply reboot. Also the executable should just go into