automake
[Top][All Lists]
Advanced

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

Re: _la_SOURCES Makro does not link all defined sources...


From: Ralf Wildenhues
Subject: Re: _la_SOURCES Makro does not link all defined sources...
Date: Wed, 12 Oct 2005 06:49:34 +0200
User-agent: Mutt/1.5.9i

Hi Steve,

* Steve wrote on Tue, Oct 11, 2005 at 11:49:54PM CEST:
> 
> I generated a shared library with automake and libtool.
> 
> My Makefile.am looks like this:
> -------------
> lib_LTLIBRARIES = libnsHTMLValidator.la
> libnsHTMLValidator_la_SOURCES = nsVector.cpp nsHTMLValidator.cpp
> libnsHTMLValidator_la_LIBADD = ./access.o \
>  ./alloc.o \
>  ./attrs.o \
*snip rest*
> INCLUDES = -I$(top_srcdir)/include
> ----------
> The buildet library should be intergrated in mozilla- firefox as a plugin...

Hmm.  I'm not quite sure why you list all the objects in *_LIBADD
individually, rather than doing
  libnsHTMLValidator_la_SOURCES = \
  nsVector.cpp \
  nsHTMLValidator.cpp \
  alloc.cpp \
  ...
(or whatever the source for alloc.o etc. are called)

but two things come to mind: First, the way you do it, you have to make
sure yourself, that alloc.o etc. are compiled with PIC flags.  To avoid
this, you could list `libtool objects' instead: "alloc.lo attrs.lo ..".

The other thing I notice is that I would always write `alloc.o' instead
of `./alloc.o'.  I haven't tested now if it applies in this case, but in
general some `make' implementations do not treat both the same.

Both of these remarks are unlikely to be relevant to the issue you
experience, though.

Oh, another thing: if the thingy is going to be a module to be dlopen'ed
by firefox (is that correct?), I'd guess it should not end up in
$libdir, so the prefix should not be lib_LTLIBRARIES, but something more
appropriate (better look how other such modules are built); also, you
should use `-module' then.

> Now when i call a method from this library
> firefox crashes with the following error message:
> -------------
> /usr/lib/mozilla-firefox/firefox-bin: symbol lookup error: 
> /home/redwing/.mozill
> a/firefox/2672ipxo.default/extensions/{7bddcea3-87bb-4eb0-ac29-3ba39d1c8a65}/com
> ponents/nsHTMLValidator.so: undefined symbol: 
> _ZN8nsVectorI8nsCOMPtrI17nsIValida
> torErrorEEC1Ev
> -------------
> So everytime when i call a function defined in nsVector.cpp it cannot
> find the symbol of this function. So i think the object file of 
> nsVector.cpp is not linked
> against this library...
> When i defined all Functions in one file (nsHTMLValidator.cpp) it works 
> for me, but that cannot be the way to rome.

Nope, right.  Can you make sure the symbol makes it into the .so file
(use `nm | grep _ZN8nsVectorI8nsCOMPtrI17nsIValidatorErrorEEC1Ev' for
example)?  Could you show the way the modules is linked: `libtool
--mode=link' line plus all its output?

Cheers,
Ralf




reply via email to

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