Re: :dll and linking to other libraries

Bram Moolenaar <[email protected]> Sun, 25 Jul 2004 18:17:13 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Magnus Therning wrote:

> >> But the resulting shared lib isn't linked to any of the libraries:
> >> 
> >>  $ ldd libsqlite.so
> >>          statically linked
> >> 
> >> Why is it like this?
> >
> >I don't understand your "ldd" command.  It should be used on a program
> >to show what libraries it uses.  I don't think it makes sense using it
> >on a library.
> 
> Yes, it does. At least on Linux:

It appears you are using Linux-specific things.  Aap tries to be
portable, thus not rely on system-specific implementation of commands.

> >I also don't understand the intention of using the add_LIBS attribute
> >on the shared library.  Do you want to build the shared library with
> >these libs?  Then putting this in the :dll command might work better.
> 
> Do you mean that I shouldn't use :attr the way I have? I put it on a
> separate line to make things a little more readable.

When you add attributes to an item it's not directly clear what you
intend to do.  If the attribute is specific for producing a item, it's
better to specify it where the production rule of the item is given.
Otherwise Aap may think the attribute applies to where the item is used
as a source.

> Yes, I want to make use of the ability for ELF shared libraries to
> themselves being linked to shared libraries. Then I can do the following
> linkage:
> 
>  sqlite3 linked with libsqlite.so
>  libsqlite.so linked with libtcl.so libm.so
> 
> This way anyone that creates an executable that is linked to
> libsqlite.so won't need to bother about libtcl.so and libm.so.
> 
> I think I found the problem. The :dll rule results in a link command
> like this:
> 
>  ld -shared -o $(target) $(source)
> 
> if the link command would be:
> 
>  gcc -shared -o $(target) $(source)
> 
> then it would work as I expected it to. Also, I don't know what variable
> is used to get the link command for :dll rules (it isn't $LD AFAIK).

Sometimes it's useful to look in the default.aap recipe.  This is where
the default behavior is specified.  $LD is used, thus setting $LD to
gcc should work.  Did you try that?

-- 
Ed's Radiator Shop: The Best Place in Town to Take a Leak.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///


-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click