[geos-devel] MingW compilation errors and patches

Charlie Savage cfis at savagexi.com
Mon Jun 26 05:21:57 EDT 2006


Three MingW compiling issues (this is gcc 3.4.5 on Windows).  First one 
I'm not sure what to do about, the other two I've attached patches.  Let 
me know if I should check them in .

1.  The destructors in the .inl files seem to confuse ld.  In the 
linking stage there are about 10 errors like these:

libs/libgeos.lax/libalgorithm.a/MCPointInRing.o: In function 
`ZN4geos9algorithm13MCPointInRing10MCSelecterD1Ev':C:/Development/msys/src/geos/source/algorithm/../../source/headers/geos/algorithm/PointInRing.h:(.text$_ZN4geos4geom11LineSegmentD1Ev[__ZN4geos4geom11LineSegmentD1Ev]+0x0): 
multiple definition of `geos::geom::LineSegment::~LineSegment()'
.libs/inlines.o:C:/Development/msys/src/geos/source/../source/headers/geos/geom/LineSegment.inl:51: 
first defined here

Any suggestions?


2.  The finite function

  g++ -DHAVE_CONFIG_H -I. -I. -I../../source/headers 
-I../../source/headers/geos -I../../source/headers -g -O2 -DGEOS_INLINE 
-Wall -ansi -pedantic -Wno-long-long -MT HCoordinate.lo -MD -MP -MF 
.deps/HCoordinate.Tpo -c HCoordinate.cpp  -DDLL_EXPORT -DPIC -o 
.libs/HCoordinate.o
HCoordinate.cpp: In member function `long double 
geos::algorithm::HCoordinate::getX() const':
HCoordinate.cpp:188: error: `finite' was not declared in this scope
HCoordinate.cpp:188: warning: unused variable 'finite'


Patch:

Index: source/headers/geos/platform.h.in
===================================================================
RCS file: /home/cvs/postgis/geos/source/headers/geos/platform.h.in,v
retrieving revision 1.10
diff -u -r1.10 platform.h.in
--- source/headers/geos/platform.h.in	12 Jun 2006 13:57:54 -0000	1.10
+++ source/headers/geos/platform.h.in	26 Jun 2006 08:03:12 -0000
@@ -37,6 +37,10 @@
  #define FINITE(x) ( (x) != DoubleNotANumber && (x) != DoubleInfinity 
&& (x) != DoubleNegInfinity )
  #define ISNAN(x) ( (x) == DoubleNotANumber )

+#if defined(__GNUC__) && defined(_WIN32)
+#define finite(x) FINITE(x)

+#endif
+
  #ifdef HAVE_INT64_T_64
    typedef int64_t int64;
  #else



3.  gettimeofday


  g++ -DHAVE_CONFIG_H -I. -I. -I../../source/headers 
-I../../source/headers/geos -I../../source/headers -g -O2 -DGEOS_INLINE 
-Wall -ansi -pedantic -Wno-long-long -MT CoordinateSequence.lo -MD -MP 
-MF .deps/CoordinateSequence.Tpo -c CoordinateSequence.cpp  -DDLL_EXPORT 
-DPIC -o .libs/CoordinateSequence.o
In file included from ../../source/headers/geos/profiler.h:22,
                  from CoordinateSequence.cpp:17:
../../source/headers/geos/timeval.h: In function `int 
gettimeofday(timeval*, timezone*)':
../../source/headers/geos/timeval.h:60: error: `tzset' was not declared 
in this scope
../../source/headers/geos/timeval.h:60: warning: unused variable 'tzset'
../../source/headers/geos/timeval.h:63: error: `_timezone' was not 
declared in this scope
../../source/headers/geos/timeval.h:64: error: `_daylight' was not 
declared in this scope
../../source/headers/geos/timeval.h:63: warning: unused variable '_timezone'
../../source/headers/geos/timeval.h:64: warning: unused variable '_daylight'


Patch:


Index: source/headers/geos/timeval.h
===================================================================
RCS file: /home/cvs/postgis/geos/source/headers/geos/timeval.h,v
retrieving revision 1.3
diff -u -r1.3 timeval.h
--- source/headers/geos/timeval.h	20 Mar 2006 10:14:01 -0000	1.3
+++ source/headers/geos/timeval.h	26 Jun 2006 08:48:58 -0000
@@ -32,6 +32,16 @@

  #endif /* _WIN32 */

+/* For MingW the appropriate definitions are included in
+ time.h but they are protected by the __STRICT_ANSI__
+ definition.  Since GEOS is compiled with -ansi and
+ -pedantic, they don't get included. */
+#if defined(_WIN32) && defined(__GNUC__)
+extern _CRTIMP void __cdecl	_tzset (void);
+__MINGW_IMPORT int	_daylight;
+__MINGW_IMPORT long	_timezone;
+#endif
+
  #if defined(_WIN32) && !defined(_WIN32_WCE)

  __inline int gettimeofday(struct timeval *tv, struct timezone *tz)



Thanks,

Charlie
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20060626/033d2c5f/smime.bin


More information about the geos-devel mailing list