guile-user
[Top][All Lists]
Advanced

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

Re: dynamic-link and LD_LIBRARY_PATH


From: Bill Gribble
Subject: Re: dynamic-link and LD_LIBRARY_PATH
Date: 17 Dec 2001 14:20:51 -0600

On Mon, 2001-12-17 at 13:29, Anthony W. Juckel wrote:
> > If you open the .la file instead of the .so, or better yet don't specify
> > any extension at all, you'll have a better chance of getting the libs
> > you need loaded automatically.  Assuming that the person who built the
> > library actually linked it against everything it needs.  
> > 
> > b.g.
> 
> So, the remaining questions is, how to get around this.  After doing an
> nm on the requisite shared library, I'm definitely seeing many undefined
> procedures, so how do I figure out which libraries are needed?  Is there
> any reason to not link a shared library against all of its required
> libraries?

Sometimes two shared libraries can have circular dependencies.  This is
not an ideal situation, and you want to break such cycles where you can,
but you may not be able to.  In many such cases, it can be difficult to
get the linker to do what you want, and it may be easier just to leave
the dependencies unexpressed.  

If there aren't any circular dependencies, I see no reason why a library
shouldn't have all of its dependencies expressed in the .la file.  Most
people seem not to think this is important, unfortunately.  In gnucash,
we recommend that the 'make check' suite for shared libraries include
the trivial check for dependency completeness, which is to compile the
program 

int main(int argc, char ** argv} { return 0; }

but to add 'my_new_library.la' to the link line.

There are several ways to find out about library dependencies, depending
on where you got the lib from.  These days many package authors provide
a foo-config type script which you can ask for the link-time
dependencies.  That may or may not be useful to you in an automatic
dependency finder, but at worst you can pick through the output by hand
and figure out what other libraries you need to dlopen before your
target library.

Good luck,
b.g.
 







reply via email to

[Prev in Thread] Current Thread [Next in Thread]