geos

Building GEOS on CentOS

It should be simple, but I ran into a number of errors.

First I got stuck on libtool: line 990: g++: command not found. It turns out I needed to install g++ using:

yum install gcc-c++

Then I got stuck on this one:

platform.h:110:2: error: #error "Can not compile without isnan function or macro
[...]
"Coordinate.inl:38: error: ‘ISNAN’ was not declared in this scope

The author of this page faced the problem, but the real insight came from this bug report on an unrelated project:

In these versions of g++ isnan is defined as a macro in <math.h> unless is included, in which case std::isnan() is defined instead.

And so I tried replacing #include <math.h> with #include <cmath> in include/geos/platform.h. Amazingly, that worked.