Re: :dll and linking to other libraries

Magnus Therning <[email protected]> Mon, 26 Jul 2004 00:26:42 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
On Sun, Jul 25, 2004 at 06:17:13PM +0200, Bram Moolenaar wrote:
>
>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.

Well, I'd argue that part of the portability of a tool would be that it
adapts to the platform and its tools. On Windows it adapts and uses the
M$ tools, why doesn't it adapt to Linux?

Besides this isn't a Linux specific thing:

 ldd(1) man pages:
 SunOS: http://bama.ua.edu/cgi-bin/man-cgi?00+00
 FreeBSD: http://www.freebsd.org/cgi/man.cgi?query=ldd&sektion=1&apropos=0&manpath=freebsd

>> >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.

Ah, that may explain it.

>> 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?

The line

 LD = gcc

has absolutely no effect on :dll rules for me, linking is still done
with 'ld -shared'.

 $ aap --version
 A-A-P recipe executive version 1.055; released 2004 Feb 01 15:17:35 GMT

That is what is in Debian Unstable/Testing at the moment.

/M

-- 
Magnus Therning                    (OpenPGP: 0xAB4DFBA4)
[email protected]
http://magnus.therning.org/

Teach a man to make fire, and he will be warm for a day. Set a man on fire,
and he will be warm for the rest of his life.
     -- John A. Hrastar
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBBDOiiMWTaatN+6QRAmRjAKDBypevHxLPtgFUz+davUqIzB3DBACgh5/j
HN2jZyqNuzgh9hIZWJ4XQf4=
=h6Ml
-----END PGP SIGNATURE-----