libtool
[Top][All Lists]
Advanced

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

Re: using .la or .a when linking an executable ?


From: Vincent Torri
Subject: Re: using .la or .a when linking an executable ?
Date: Mon, 29 Sep 2008 21:47:02 +0200 (CEST)


Hey,

Sorry, Ralf, i've just deleted your answer. It was embedded in a lot of spams... I paste it below.


Hello Vincent,

* Vincent Torri wrote on Sun, Sep 28, 2008 at 01:04:44PM CEST:
eet_LDADD = $(top_builddir)/src/lib/libeet.la

Hence when I call objdump -p on my eet binary, i get:

  NEEDED      libeet.so.1
  NEEDED      libz.so.1
  NEEDED      libjpeg.so.62

But a friend told me that the eet binary should not have libz and
libjpeg, only libeet.

On many modern systems it is not necessary to link against indirect
dependencies.

1) Is my friend right ?

Partly.

2) If he is right, what should I do to remove those "dependencies" ?
(flag to pass in a variable in my Makefile.am, or something like that)

You can pass -Wl,--as-needed when the linker is the GNU binutils one.
But beware that it may break things with some compilers (notably C++
ones), with some apps that do dlopen and expect dependencies to be
present, and did not work right in some older versions of ld.

Do you have an idea if:

 * it works on Windows (mingw binutils) ?
 * from which version of ld it is safe to use that flag ?

I tried and with my binutils (linux for now), it works (at least objdump does not report other dependencies, i've not tried yet the program)

eet_LDADD = $(top_builddir)/src/lib/libeet.la
eet_DEPENDENCIES = $(top_builddir)/src/lib/libeet.la

The last line is not needed, automake can infer that from the one above.

Indeed :) I learn autotools things every days :) Now I have to clean all our libs and our main programs...

thank you very much

Vincent Torri




reply via email to

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