[C++-sig] Import error: undefined symbol

Marcelo A. Camelo camelo at esss.com.br
Fri May 23 19:06:52 CEST 2003


Hi!!!

Problem resolved. 

For the records: it was due to a particularity in the 
way that GCC handles friends of template classes. 
Because we were declaring them in a non GCC way (which 
the Intel compiler handles nicely), it ended up not 
being instancialized by the compiler.

Once we switched to the GCC friendly declaration the 
problem went away.

For further information about how different compilers
handle template friends declarations, refer to:

http://www.cuj.com/documents/s=8244/cujcexp2101sutter/

Cheers,
 

Marcelo A. Camelo, M. Eng. - Project Leader
ESSS - Engineering Simulation and Scientific Software
 
E-mail: camelo at esss.com.br
Phone: +55-48-239-2226

Keywords: GCC, ImportError, undefined symbol, python, templates, friend,
shared

-----Original Message-----
From: c++-sig-admin at python.org [mailto:c++-sig-admin at python.org] On
Behalf Of Marcelo A. Camelo
Sent: sexta-feira, 23 de maio de 2003 09:12
To: c++-sig at python.org
Subject: [C++-sig] Import error: undefined symbol


Hello again!!!

Like I've said in a previous post, I'm having a strange 
linking problem in GCC (upgrading to 3.3 didn't help, as 
I suspected). 

I'm still investigating the root of it by simplifying the 
troublesome module. In the mean time, I decided to share 
my problem in the hope of someone here being familiar 
with such error or maybe getting more information about
the internals of a GCC shared library.

Down to it:

My shared lib compiles and links with no error or warning. 
When trying to import it from python, I get the following 
error message:

ImportError: ./_coilibmodule.so: undefined symbol: 
_ZN6coilib17unstructuredblockeqERKNS0_19IEdgeOnFaceIteratorIN4Loki8Typel
istINS0_11ElementBaseILj3ELj4ELi3EEENS2_8NullTypeEEEEESA_

which suggests that the object file containing that symbol 
hasn't been linked into the final binary. The problem is 
that the file is being linked for sure. 

I've 'grep'ed both the obj file and the final shared 
library for the missing symbol and the match was positive, 

As you can guess from the name of the symbol, this code 
relies on heavy template machinery. Maybe this can be part 
of the problem.

As usual, the system builds and runs fine on win32 systems.

If anyone here has already faced a similar problem or can 
spot any flaws in my thinking, please let me know. Any help 
will be greatly appreciated. 

I will get back to my investigation now. Any relevant 
discovery will be posted to the list.

Cheers,

 

Marcelo A. Camelo, M. Eng. - Project Leader
ESSS - Engineering Simulation and Scientific Software
 
E-mail: camelo at esss.com.br
Phone: +55-48-239-2226
 


_______________________________________________
C++-sig mailing list
C++-sig at python.org
http://mail.python.org/mailman/listinfo/c++-sig





More information about the Cplusplus-sig mailing list