Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#595 closed defect (fixed)

Compiling under cygwin failed because isnan was not found

Reported by: Keichi Owned by: pramsey
Priority: major Milestone: 3.3.7
Component: Build/Install Version: 3.3.5
Severity: Critical Keywords: cygwin
Cc:

Description

Hello,

i just tried to build libgeos 3.3.5 under cygwin 1.7.16-1 to get the Openstreetmap History Splitter running, but it failed because it could not find isnan as a function or a Macro. As for as i know, has cygwin the function already implanted, but libgeos fails to regnoize it.

/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../include -I../../../include/geos -I../../../include -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -ffloat-store -g -O2 -MT IndexedPointInAreaLocator.lo -MD -MP -MF .deps/IndexedPointInAreaLocator.Tpo -c -o IndexedPointInAreaLocator.lo IndexedPointInAreaLocator.cpp libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../include -I../../../include/geos -I../../../include -DGEOS_INLINE -pedantic -Wall -ansi -Wno-long-long -ffloat-store -g -O2 -MT IndexedPointInAreaLocator.lo -MD -MP -MF .deps/IndexedPointInAreaLocator.Tpo -c IndexedPointInAreaLocator.cpp -DDLL_EXPORT -DPIC -o .libs/IndexedPointInAreaLocator.o In file included from ../../../include/geos/geom/Geometry.h:26:0,

from IndexedPointInAreaLocator.cpp:18:

../../../include/geos/platform.h:110:2: error: #error "Can not compile without isnan function or macro" In file included from ../../../include/geos/geom/Coordinate.h:161:0,

from ../../../include/geos/geom/Envelope.h:26, from ../../../include/geos/geom/Geometry.h:28, from IndexedPointInAreaLocator.cpp:18:

../../../include/geos/geom/Coordinate.inl: In member function ‘bool geos::geom::Coordinate::isNull() const’: ../../../include/geos/geom/Coordinate.inl:39:17: error: ‘ISNAN’ was not declared in this scope ../../../include/geos/geom/Coordinate.inl: In member function ‘bool geos::geom::Coordinate::equals3D(const geos::geom::Coordinate&) const’: ../../../include/geos/geom/Coordinate.inl:83:28: error: ‘ISNAN’ was not declared in this scope Makefile:372: recipe for target `IndexedPointInAreaLocator.lo' failed make[4]: * [IndexedPointInAreaLocator.lo] Error 1 make[4]: Leaving directory `/home/Keichi/geos-3.3.5/geos-3.3.5/src/algorithm/locate' Makefile:391: recipe for target `all-recursive' failed make[3]: * [all-recursive] Error 1 make[3]: Leaving directory `/home/Keichi/geos-3.3.5/geos-3.3.5/src/algorithm/locate' Makefile:443: recipe for target `all-recursive' failed make[2]: * [all-recursive] Error 1 make[2]: Leaving directory `/home/Keichi/geos-3.3.5/geos-3.3.5/src/algorithm' Makefile:474: recipe for target `all-recursive' failed make[1]: * [all-recursive] Error 1 make[1]: Leaving directory `/home/Keichi/geos-3.3.5/geos-3.3.5/src' Makefile:365: recipe for target `all-recursive' failed make: * [all-recursive] Error 1

The bug seems to be there, since version 3.2.0 of libgeos, because libgeos 3.1.1rc1 was the last version the build perfectly under cygwin. But it's useless for me because IndexedPointInAreaLocator.h is missing, which is need by osm-history-splitter.

Change History (5)

comment:1 by strk, 11 years ago

Milestone: 3.3.63.3.7

please check the output of ./configure, which is where the isnan macro should be detected. Patches are welcome.

comment:2 by jhuntley, 11 years ago

I was able to fix this and get libgeos-3.3.6 to build under cygwin by adding the a cygwin define beside the mingw define. Edit the following file and add:

include/geos/platform.h, line 87

#if defined(HAVE_ISNAN)
# define ISNAN(x) (isnan(x))
#else
# if defined(_MSC_VER)
#  define ISNAN(x) _isnan(x)
# elif defined(__MINGW32__) || defined(__CYGWIN__)
// sandro furieri: sanitizing MinGW32
#  define ISNAN(x) (std::isnan(x))
# elif defined(__OSX__) || defined(__APPLE__)
   // Hack for OS/X <cmath> incorrectly re-defining isnan() into oblivion.
   // It does leave a version in std.
#  define ISNAN(x) (std::isnan(x))
# elif defined(__sun) || defined(__sun__)
#  include <math.h>
#  define ISNAN(x) (::isnan(x))
# endif
#endif

I also had to apply this change:

http://trac.osgeo.org/geos/attachment/ticket/319/geos-3.2.0-1.src.patchmake

You will want to make this change after running ./configure of course. I think configure takes the platform.h.in and generates the platform.h, so be careful of the order. Just run make afterwards, wait a while, make install, and the build should have completed and installed successfully.

comment:3 by jhuntley, 11 years ago

Link reference and content:

http://trac.osgeo.org/geos/attachment/ticket/319/geos-3.2.0-1.src.patch

geos-3.2.0/tests/xmltester/tinyxml/tinyxml.h
old	 new	 
38	38	#include <string.h> 
39	39	#include <assert.h> 
40	40	 
 	41	extern "C" int snprintf(char *, size_t, const char *, ...); 
 	42	 
41	43	// Help out windows: 
42	44	#if defined( _DEBUG ) && !defined( DEBUG ) 
43	45	#define DEBUG

comment:4 by jhuntley, 11 years ago

Resolution: fixed
Status: newclosed

I submitted a fix for this to github:

https://github.com/libgeos/libgeos/pull/2

comment:5 by strk, 11 years ago

Committed in r3771

Note: See TracTickets for help on using tickets.