[geos-devel] Using SWIG to interface with GEOS, undefined symbols

Sean Gillies sgillies at frii.com
Mon Jul 12 10:41:07 EDT 2004

Hi all,

Yesterday I began to try to use SWIG to generate a Python
GEOS module using the CVS GEOS.  To start, I am only wrapping
the classes in geom.h and precision.h.

SWIG 1.3.20 generates wrapper code with only a few warnings
and the module does build, resulting in geos.py and a very
large _geos.so (I have statically linked against libgeos.a).

On import of the geos module, an import error is raised:

   undefined symbol: _ZN4geos14PrecisionModel19maximumPreciseValueE

I think there is a problem not just with this symbol but with others.
If I comment out the reference to the above in the GEOS wrapper and
rebuild, I get an ImportError with a different undefined symbol.
The symbols *are* in libgeos.a, and I'm certain that I've properly 
I'm making sure to use g++ for the linker, avoiding one of the most
common SWIG C++ module pitfalls.

Anyone else taken a swing at a GEOS module with SWIG and run into
this problem?


Sean Gillies
sgillies at frii dot com

More information about the geos-devel mailing list