[geos-devel] GEOS 3.0.2 fails to compile under MingW Win32
Mark Cave-Ayland
mark.cave-ayland at ilande.co.uk
Sun Oct 19 16:48:56 EDT 2008
Hi everyone,
I've started looking at compiling the latest versions of GEOS/PostGIS
for the Win32 installers and have found that the latest GEOS 3.0.2 does
not compile.
The issue is that GEOS is compiled using the -ansi flag, and since the
new CLocalizer.cpp file uses strdup() which is not an ANSI function then
the build blows up. Interestingly enough, it will build for me on Linux
so I have no idea why MingW in particular is much more strict about
this.
Note that before we have been able to add some definitions protected by
-ansi by copying the definitions from the header files. Unfortunately
while this allows the compile to proceed, the link fails with an
undefined symbol error and so I guess there is trickery further down
within the MingW runtimes to prevent these symbols from even being
visible in ANSI mode :(
My current solution is the attached patch which works by replacing
strdup() with a simple malloc() and strcpy() to preserve the old locale.
Note that this will almost certainly need to be applied to the 3.1
branch too, although I haven't got as far as trying to compile it on
Win32 - yet ;)
ATB,
Mark.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geos-3.0.2-strdup.patch
Type: text/x-patch
Size: 800 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20081019/0dbb0644/geos-3.0.2-strdup.bin
More information about the geos-devel
mailing list