GDB a VFS module
jaganra at yahoo.com
Thu Apr 22 20:22:17 GMT 2004
I did a gcc -shared -Ixxx -LYYY -ldrivers -lutils -o abc.so.
It worked fine and I did a nm on it and it showed no undefined. The actual
libraries that I wanted to link are libdrivers.a and libutils.a which are in
-L path specified. Then I ran abc.so from vfstest and same problem again.
Jelmer: I looked at the mysql make and it has a configure option hooked onto
it. Even then
-lmysql is also linking in a .so . In my case I am linking in ".a" into a
".so". Is that a legal thing to do at all.
with best regards
From: Henrik Nordstrom [mailto:hno at squid-cache.org]
Sent: Thursday, April 22, 2004 3:49 AM
Cc: Jelmer Vernooij; samba-technical at lists.samba.org
Subject: Re: GDB a VFS module
On Wed, 21 Apr 2004, Jagan wrote:
> * Did the gcc -shared stuff. Didnt help.
It is the -l... stuff you need.
> * If individual modules are responsible for linking their own
> libraries then why does a compile of abc.so not complain at all. Also
> ldd of abc.so does not reveal any unlinked dependencies.
Because there is no final linking of abc.so taking place until it is loaded
into the application. These missing symbols are simply assumed to be
provided by anoter object later on. The compiler does not know where unless
you instruct it to.
By using the -l.. flags when linking the abc.so file you record which
libraries this file depends on, causing these libraries to be loaded at the
same time as this file.
In the same way you can use the ld -rpath flag or LD_RUN_PATH variable to
record any additional directories needed in the search path for finding the
needed libraries at runtime linking without having to set LD_LIBRARY_PATH
each time when running the application.
> In other words the question is how can individual modules make sure
> they have no unlinked dependecies on a compile from the souce tree.
By instructing the compiler to link to the libraries they need while
building the so file.
More information about the samba-technical