Using a procedure for building geos on ubuntu 12.04, I'm trying to build geos on 14.04 and get the error, "Can not compile without isnan function or macro" when make is executed.

sudo apt-get -y install build-essential

wget http://download.osgeo.org/geos/geos-3.4.2.tar.bz2

tar xvfj geos-3.4.2.tar.bz2
cd geos-3.4.2

for some reason the isnan() macro doesn't seem to be available on 14.04, how can I get this to compile?


libgeos-3.4.2 is in main Ubuntu repository for Ubuntu 14.04. So you dont need to execute difficult compiling methods.

libgeos-3.4.2 and its needed packages can be installed with :

sudo apt-get install libgeos-3.4.2 libgeos-c1 libgeos-dbg libgeos-dev libgeos-doc libgeos-ruby1.8 ruby-geos libgeos++-dev
  • 1
    +1 However, I expect that there are other libraries out there which have the same issue, and may not be in the repository. So I'll leave this open to see if someone knows how to resolve the compilation issue. – monkut May 14 '14 at 5:09
  • 1
    Same problem on Arch Linux. I want to compile it for myself in order to compile it the way I want it. – Golar Ramblar Jan 3 '17 at 10:42
  • 14.04 is approaching EOL, so it becomes necessary to compile from source to use the latest libraries for libgeo, postgis etc – prusswan Nov 21 '18 at 6:20

I had the same problem. For me it came about from the following sequence of steps

  • ./configure
  • make
  • Discover missing g++ and install it: sudo aptitude install g++
  • make

The problem is that configure had made some decisions based on what tools were installed, but they were the wrong ones. The solution is to rerun configure after installing g++.

@user224082 Although Ubuntu 14.04 provides libgeos, it does not provide the PHP bindings, so you still have to compile by hand if you need those.


If all of the existing answers do not help you, as was my case, you can try ensuring that the macro is being defined during compile time.

When you have identified the include that is supposed to ensure the macro can be compiled in my case: Coordinate.inl

enter image description here

in the case of geos-3.3.3 the macro is defined in platform.h


Just replace line 24, with:

#define HAVE_ISNAN 1

Done. I really hope you got help from a different answer before you went for this one, but it definitely fixes the raised issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.