[Top][All Lists]

[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 17:59:33 +0200
User-agent: Mutt/1.5.11

Hi Steve,

* Steve wrote on Wed, Oct 12, 2005 at 04:37:37PM CEST:
> Ralf Wildenhues wrote:
> >So, we're back to the prize question: which entity defines
> >| nsVector<nsCOMPtr<nsIValidatorError> >::nsVector()
> >
> >?  Unfortunately, I am blissfully ignorant of mozilla source, so I can
> >only guess randomly: you are missing some template instantiation?
> >
> Hm i dont know exactly what do you mean with instantiation
> heres a little piece of my code, which should describe it:
> -----------------------------------------
> class nsHTMLValidator : public nsIValidator
> {
>    //all the following symbols are marked as undefined:
>    ...
>    nsVector<nsCOMPtr<nsIValidatorError> > m_errorList;   
> //Instantiation of a nsVector object
>    nsVector<nsEmbedCString> m_sourceLines;
>    nsVector<nsEmbedCString> m_errorStringList;
>    ...
> };
> //and the nsVector itselfs is a template with template functions
> //and of course a default constructor:
> template <class T>
> class nsVector{
>    ....
> };

Where is above code located?

> No when the implementation of the template functions of nsVector are
> defined in the same file as the Functions for the nsHTMLValidator all 
> went well.
> If not the evil undefined symbols occure :)

Well, sure.  They have to be in the same source file or in a header that
is included there (the latter preferred).

This is how template instantiation in C++ (specifically with g++) works.
The template *definition* has to be visible in order that the
instantiation works, or you have to add some other means of explicit
instantiation (unless you use `export', which only very few C++
compilers support, and g++ isn't among them).  See
  info gcc "Template Instantiation"
or maybe first
or some good C++ book on this topic,
or go straight for ISO/IEC 14882:1998(E) chapter 14 if you have the
standard available.

This has little to do with either Automake or libraries (well, there are
issues with multiple instantiations and shared libraries, but with g++
things are usually well).  So it would probably better be discussed
further elsewhere (dunno where, though).  Also, I'm not the right person
to ask, really.

> >>/bin/sh ../libtool --tag=CXX --mode=link g++  -g -O2  -L 
> >>/usr/lib/gecko-sdk/lib -L /usr/lib/gecko-sdk/bin -o 
> >> -rpath /usr/local/lib  nsHTMLValidator.lo 
> >>nsVector.lo tidy/access.o tidy/alloc.o tidy/attrs.o tidy/config.o 
[ ... ]
> >
> >AFAICS, that's the command line.  I always also would like to see what
> >executing this command line generates (output from `libtool', output
> >from `g++', whatever comes out on stdout and stderr).
> >
> Ok heres the whole output:

Thank you for including the output.

> /bin/sh ../libtool --tag=CXX --mode=link g++  -g -O2  -L 
> /usr/lib/gecko-sdk/lib -L /usr/lib/gecko-sdk/bin -o 
> -rpath /usr/local/lib  nsHTMLValidator.lo nsVector.lo 
> nsHTMLValidatorModule.lo tidy/
> rm -fr  .libs/libnsHTMLValidator.a .libs/ 
> .libs/libnsHTMLValidator.lai .libs/ 
> .libs/ .libs/
> g++ -shared -nostdlib 
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/../../../crti.o 
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/crtbeginS.o  .libs/nsHTMLValidator.o 
> .libs/nsVector.o .libs/nsHTMLValidatorModule.o -Wl,--whole-archive 
> tidy/.libs/libtidy.a -Wl,--no-whole-archive  -Wl,--rpath -Wl,/usr/lib/. 
> -Wl,--rpath -Wl,/usr/lib/.  
> -L/home/redwing/documents/programming/face/components/src 
> -L/home/redwing/documents/programming/face/components/src/tidy 
> -L/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6 
> -L/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/../../../../i686-pc-linux-gnu/lib 
> -L/usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/../../.. /usr/lib/./ 
> -L/usr/i486-slackware-linux/bin -L/usr/i486-slackware-linux/lib 
> -L/usr/lib/gcc-lib/i486-slackware-linux/../../../i486-slackware-linux/lib 
> -L/usr/lib/gcc-lib/i486-slackware-linux/../.. -lm -lc -lgcc_s 
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/crtendS.o 
> /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.6/../../../crtn.o  -Wl,-soname 
> -Wl, -o .libs/

Independent of your problem, there are a few bogus
  -Wl,--rpath -Wl,/usr/lib/.
entries created here.  I suspect a libtool bug.

Can you please send `../libtool --version'?
If the version is newer than 1.5.10,
then please also send the output of `libtool --tag=CXX --config',
else don't bother (but do consider updating to Libtool 1.5.20).

Thank you.

> Hope you can read out some more information....

Yep: the rest looks fine to me, and this is often a good thing to know,
too (for you, but also for me).  ;-)


reply via email to

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