tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Linker and inter-library dependencies



On Sat, May 21, 2011 at 01:55:10PM +0000, Christos Zoulas wrote:
> In article <4DD78786.4050706%msys.ch@localhost>, Marc Balmer  
> <marc%msys.ch@localhost> wrote:
> >I am having some trouble with inter-library dependencies.
> >
> >A small C programs links against
> >/usr/pkg/java/openjdk7/jre/lib/i386/libjava.so.  libjava.so itself has
> >some dependencies, which are found in the same directory as libjava.so
> >itself and the client/ directory below:
> >
> >netbsd5# ldd libjava.so
> >
> >libjava.so:
> >        -ljvm => not found
> >        -lverify => not found
> >        -lc.12 => /usr/lib/libc.so.12

As might have been mentioned elsewhere, it is more informative to look at
the output of 'objdump -p', in particular the RPATH and NEEDED entries of
the program and libraries.

> Yes, this is by design.

For some definition of the word 'design' at least :-)

> java uses LD_LIBRARY_PATH for some reason to
> resolve its dependencies (presumably so it can be installed in different
> places). The interpreter re-execs itself and sets LD_LIBRARY_PATH.

It certainly isn't really what LD_LIBRARY_PATH should be used for
(unless you are linux whuch uses it for the wrong things :-)

> This
> is what $ORIGIN was invented for, but I guess since not everyone has it
> nobody can use it.

Does $ORIGIN work within a shared library?

Could be build libjava.so with an RPATH of $ORIGIN/cleient ?

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index