[Distutils] Linking C++ under Linux

Bill Spotz wfspotz at sandia.gov
Mon Jan 12 11:55:43 EST 2004


On Friday, January 9, 2004, at 11:42  PM, Mats Wichmann wrote:

> >ImportError: ../build/lib.linux-i686-2.2/PyTrilinos/_Epetra.so:
> >undefined symbol: endl__FR7ostream
> >
> >which sure looks like a missing c++ library to me.
>
> Well, a linking problem anyway.
>
> according to c++filt: endl(long double, ostream)
>
> I'm not that much of a c++ expert, but this looks
> like a non-standard overload of endl, is that
> maybe provided by some of /your/ code and not
> getting linked in?

Hmmm.  On the system where I'm getting the problem, I get

   sahp4960(1)$ c++filt endl__FR7ostream
   endl(ostream &)

which looks like the standard definition of endl.  Interestingly, on my 
mac, I get

   samt5735a(29)$ c++filt endl__FR7ostream
   long double

which looks like some type of misinterpretation (the "l" at the end of 
"endl" wrongly interpreted as a long modifier? I don't know).  But if I 
use c++filt's "standard input mode", I get

   samt5735a(33)$ c++filt
   endl__FR7ostream    # Standard input
   endl(ostream &)     # Standard output
   Ctrl-D

Anyway, I'm pretty sure endl__FR7ostream gets demangled as endl(ostream 
&), and while I am not a primary developer of the software I am trying 
to wrap, I'd be very surprised if this gets overloaded somewhere (at 
least, a cursory search using grep didn't turn anything up).

Here is the link line generated by distutils on the Linux platform:

gcc -shared build/temp.linux-i686-2.2/Epetra_wrap.o -LCommon 
-L/usr/netpub/Trilinos-10_31_03/lib -L/usr/netpub/swig-1.3.19/lib 
-L/usr/local/python-2.2.1/lib/python2.2/config -lcommon -lswigpy 
-lepetra -lblas -llapack -lg2c -lpython2.2 -o 
build/lib.linux-i686-2.2/PyTrilinos/_Epetra.so

What surprises me is that the command is gcc rather than c++ (as it is 
on the mac) and that, given this fact, there are no c++ libraries 
included in the command line.

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-5451      **
** Albuquerque, NM 87185-0316    Email: wfspotz at sandia.gov **





More information about the Distutils-SIG mailing list