GDB a VFS module

'Jelmer Vernooij' jelmer at vernstok.nl
Thu Apr 22 20:42:21 GMT 2004


Hi Jagan,

On Thu, Apr 22, 2004 at 01:22:17PM -0700, Jagan wrote about 'RE: GDB a VFS module':
> Thanks Henrik
>          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
> the
> -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.
What kind of 'legal' do you mean ? Valid ? Or allowed by license/law?

If you would like your module to link against a static library, just specify
the path to that static library, e.g. 

gcc -shared -o abc.so abc.c -Ixxx YYY/libdrivers.a

(note that the order of the parameters does matter!)

All libraries your module uses and the module itself have to be under a 
GPL-compatible license, whether they're static or not.

Cheers,

Jelmer

> with best regards
> Jagan.

> -----Original Message-----
> From: Henrik Nordstrom [mailto:hno at squid-cache.org] 
> Sent: Thursday, April 22, 2004 3:49 AM
> To: Jagan
> 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.

> Regards
> Henrik


-- 
Jelmer Vernooij <jelmer at vernstok.nl> - http://jelmer.vernstok.nl/
Todo: 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20040422/3cd2cfba/attachment.bin


More information about the samba-technical mailing list