[geos-devel] Using SWIG to interface with GEOS, undefined symbols
strk at keybit.net
Mon Jul 12 11:39:01 EDT 2004
On Mon, Jul 12, 2004 at 09:10:53AM -0600, Sean Gillies wrote:
> On Jul 12, 2004, at 9:00 AM, strk wrote:
> >On Mon, Jul 12, 2004 at 08:41:07AM -0600, Sean Gillies wrote:
> >>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.
> >precision.h does not really contain 'basic' classes.
> >PrecisionModel class is in geom.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:
> >> ImportError:
> >> undefined symbol: _ZN4geos14PrecisionModel19maximumPreciseValueE
> >Could you have built _geos.so and the geos.py in at different times ?
> >CVS api is changing , and you get those kind of errors for every simple
> >'const' addition.
> Thanks for the reply! _geos.so and geos.py are synchronous, no problem
> there. I was having this same issue with GEOS 1.0 and SWIG, so I am
> ruling out API changes. It's either my lack of knowledge of C++, some
> undocumented SWIG issue or a combination of these.
I've checked the code. It seems a bug in both GEOS-1.0 and GEOS-CVS
PrecisionModel::maximumPreciseValue is never given a value.
geos::maximumPreciseValue is, but the header declare
geos::PrecisionModel::maximumPreciseValue, which is not.
I've fixed it, please try now.
> >>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
> >>geos-devel mailing list
> >>geos-devel at geos.refractions.net
More information about the geos-devel