bug-libtool
[Top][All Lists]
Advanced

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

Re: Strange behaviour in libtool-1.5.20


From: Ralf Wildenhues
Subject: Re: Strange behaviour in libtool-1.5.20
Date: Mon, 5 Sep 2005 16:53:28 +0200
User-agent: Mutt/1.4.1i

Hi Yuri,

Sorry for the response latency.

* Пухальский Юрий Андреевич wrote on Fri, Sep 02, 2005 at 11:39:20AM CEST:
> 
> I've encountered a strange behaviour on RedHat 9, with libtool 1.5.20
> and gcc 3.4.3. I think, with previous libtool releases was the same
> problem.  I have two files:
*snip*
> ----------------
> I have then a Makefile.am like following:
> ----------------
> noinst_LTLIBRARIES=liba.la libb.la
> 
> libb_la_SOURCES=b.c
> 
> liba_la_SOURCES=a.c
> liba_la_LIBADD=libb.la
> liba_la_LDFLAGS=-o la.o

This setting of liba_la_LDFLAGS is wrong.  You may not set the output
name in LDFLAGS.  The output name is already given implicitly, by the
variable name: it will be liba.la.

The library liba.la will be a so-called convenience archive.  Since
libb.la is a convenience archive as well, and you have given it as
LIBADD for liba.la it will be subsumed in ("copied into") liba.la.

If you want a static or shared library instead, you need to remove the
noinst_ prefix.

> Resulting object file la.o contains a.o.

Well, the libtool object "la.o" will contain references to the PIC
object .libs/a.o and to the non-PIC object a.o.

> When we configure it with --disable-shared, la.o doesn't contain a.o
> (because apparently it wants to put .libs/a.o into the library, and
> there is no such file).

liba.la is a convenience archive if listed in noinst_, and as such it
will contain only the PIC object.  If you specify --disable-shared as
configure option (or -static in liba_la_LDFLAGS, FWIW), it will be a
static convenience archive, and as such consist of non-PIC objects.

> Then question is what partial linking has to
> do with shared libraries? Because I can still make a library solely of
> a.o like following:
> -------------------
> noinst_LTLIBRARIES=liba.la libb.la libc.la
> 
> libb_la_SOURCES=b.c
> 
> libc_la_SOURCES=a.c
> 
> liba_la_SOURCES=
> liba_la_LIBADD=libc.la libb.la
> liba_la_LDFLAGS=-o la.o

This is still wrong.

> --------------
> and have both a.o and b.o in resulting la.o...

I don't understand at all what you are really trying to achieve.

Cheers,
Ralf




reply via email to

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