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

Sean Gillies sgillies at frii.com
Mon Jul 12 14:15:58 EDT 2004

On Jul 12, 2004, at 9:39 AM, strk wrote:

> 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:
>>>> /home/sean/projects/PyGEOS/build/lib.linux-i686-2.3/_geos.so:
>>>>  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.
>>> --strk;
>> 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.
>> Sean
> 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.
> --strk;

Yes, that one bug seems to be fixed.

Now there is exposed another one :)

   undefined symbol:   _ZNK4geos14CoordinateList17toCoordinateArrayEv

If I direct SWIG to ignore the toCoordinateArray() method of 
then there is yet another undefined symbol:

   undefined symbol: 

Strk, I appreciate that you have taken the time to look into it,
but this might be more time consuming.  I don't know if it will
be possible to SWIG GEOS or if it is in the project's interest to
be altered so that a SWIG module is possible.


Sean Gillies
sgillies at frii dot com

More information about the geos-devel mailing list