On Mar 22, 2000, Christopher Knight <[EMAIL PROTECTED]> wrote:

> While trying to build a shared library that makes use of the STL
> with the SunWorkshop C++ compiler 4.2 on Solaris 2.6, I have found 
> the Sun's CC does not work quite right if, when building the shared 
> library, .lo files are specified as the objects to link. The compiler
> does not recognize the .lo's as linkable objects and ignores them,
> resulting in undefined symbols.

That's a known problem, and the latest stable release of libtool says
it does not fully support any language other than C.  Work towards
supporting other languages is being done by Ossama Othman in the
multi-language branch of the libtool CVS tree.  IIRC, this
particularly problem is already fixed there, so you may want to give
it a try.

Please note that multi-language support probably won't be included in
libtool 1.4, only in release 1.5.

> If I manually replace the .lo's on the command line with the corresponding 
> .o's, everything works as advertised.

> Therefore, is there a way to force libtool to link the
> .o's rather than .lo's?

--disable-shared will do it, but that's probably not what you had in
mind :-(

> Also, almost everything works after changing all the .lo's to .o's. 

Yup.  In the multi-language branch, IIRC, the .lo file is placed in
the .libs directory, named `.o', and the .lo file is created as a
wrapper script, just like the .la files.

> However, with Sun's C++ compiler, every STL member of each template 
> instantiation becomes a .o file placed in a directory
> named by -ptr (which is passed to both the compiler and the linker).
> (I have been informed that this behavior has now been adopted by ANSI 
> and should be appearing in additional C++ compilers in the future)
> To get proper behavior one must build with -ptrdatabase.

Certainly not by ANSI, since the ANSI C++ Standard has not been
reviewed, but it may be part of the C++ ABI specification effort
http://reality.sgi.com/dehnert_engr/cxx/cxx-summary.html

> Below is a minimalistic test taken from my acinclude.m4 file
> to check whether CXXFLAGS needs a -ptr argument.

Thanks.  Ossama, can you take care of this, assuming you haven't yet?

BTW, I'm not sure simply testing whether -ptr is accepted by the
compiler is enough.  It may be silently accepted by other compilers,
with any random meaning we might think of.  We need some test that
verifies that the meaning the one we want.  I'm not sure how to
accomplish this, but it would probably involve compiling some piece of
code that makes use of certain STL templates, then a separate
translation unit that works when given the same -ptr flag, but not
when not given it.

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

Reply via email to