[geos-devel] Patch: Fixing GEOS HEAD compilation under MingW

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Wed Jan 3 04:00:48 EST 2007


Hi everyone,

After a day or so messing with the GEOS source code, I've finally
managed to get GEOS HEAD to compile under MingW. Please find enclosed
the following patch to be applied to the current SVN tree.

I believe the problem with "multiple definition" errors was caused by
the fact that under Win32 DLLs must declare all their imports and
exports at compile time - hence MingW was automatically generating
import stubs for the inline functions when compiling with the gcc
-shared option. This caused the final link against inlines.o to fail
since the compiler had two definitions to contend with - those
automatically generated by the compiler and those in inlines.o.

The patch also addresses a problem with Charlie Savage's original patch
for the _finite() function - I had to wrap this in an "extern C"
definition for the compilation to work for me. If Charlie could verify
this on his compiler setup, that would be great.

Finally, even when this patch is applied, the final link causes the
MingW linker to segfault :( This is because libtool decides that the
number of object files is so large that it needs to complete the final
link in two stages, and my guess is that there is a bug somewhere in
MingW's ld.exe when used in this way. Fortunately there is a way to
alter libtool to persuade it to link the entire library in one go (see
below).

So to complete the compilation under MingW it is necessary to perform
the following steps:

	1) Obtain GEOS HEAD from SVN and apply the attached patch
	2) Run ./configure
	3) Run the following command to persuade libtool to use
	a longer command line for linking:

	mv libtool libtool.orig
	cat libtool.orig | sed 's/max_cmd_len=8192/max_cmd_len=16384/g'
	> libtool

	4) Execute the build using "make" or "make install"


I have applied the patch to both a Win32 tree and a Linux tree, and both
seem to compile without any problems. If Charlie and Mateusz can confirm
that I haven't broken their builds, that would be great.


Kind regards,

Mark.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: geos-3.0.0-mingw.patch
Type: text/x-patch
Size: 1413 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20070103/e392e737/geos-3.0.0-mingw.bin


More information about the geos-devel mailing list