Tuesday, 7 July 2015

geodjango - Error building GEOS on Ubuntu 18.04


Following the directions to install geodjango on linux ubuntu 18.04, so far here are my commands:



sudo apt-get install binutils libproj-dev gdal-bin

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

tar xjf geos-3.4.2.tar.bz2

sudo apt-get install build-essential

cd geos-3.4.2


./configure

make

I get this error


In file included from ../../../include/geos/geom/Geometry.h:25:0,
from IndexedPointInAreaLocator.cpp:17:
../../../include/geos/platform.h:112:2: error: #error "Can not compile without isnan function or macro"
#error "Can not compile without isnan function or macro"
^~~~~

In file included from ../../../include/geos/geom/Coordinate.h:158:0,
from ../../../include/geos/geom/Envelope.h:25,
from ../../../include/geos/geom/Geometry.h:27,
from IndexedPointInAreaLocator.cpp:17:
../../../include/geos/geom/Coordinate.inl: In member function ‘bool geos::geom::Coordinate::isNull() const’:
../../../include/geos/geom/Coordinate.inl:38:10: error: ‘ISNAN’ was not declared in this scope
return (ISNAN(x) && ISNAN(y) && ISNAN(z));
^~~~~
../../../include/geos/geom/Coordinate.inl:38:10: note: suggested alternative: ‘SNAN’
return (ISNAN(x) && ISNAN(y) && ISNAN(z));

^~~~~
SNAN
../../../include/geos/geom/Coordinate.inl: In member function ‘bool geos::geom::Coordinate::equals3D(const geos::geom::Coordinate&) const’:
../../../include/geos/geom/Coordinate.inl:77:21: error: ‘ISNAN’ was not declared in this scope
((z == other.z)||(ISNAN(z) && ISNAN(other.z)));
^~~~~
../../../include/geos/geom/Coordinate.inl:77:21: note: suggested alternative: ‘SNAN’
((z == other.z)||(ISNAN(z) && ISNAN(other.z)));
^~~~~
SNAN

Makefile:372: recipe for target 'IndexedPointInAreaLocator.lo' failed
make[5]: *** [IndexedPointInAreaLocator.lo] Error 1
make[5]: Leaving directory '/home/ralph/geos-3.4.2/src/algorithm/locate'
Makefile:391: recipe for target 'install-recursive' failed
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory '/home/ralph/geos-3.4.2/src/algorithm/locate'
Makefile:445: recipe for target 'install-recursive' failed
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory '/home/ralph/geos-3.4.2/src/algorithm'
Makefile:476: recipe for target 'install-recursive' failed

make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory '/home/ralph/geos-3.4.2/src'
Makefile:367: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/home/ralph/geos-3.4.2'
Makefile:677: recipe for target 'install' failed
make: *** [install] Error 2

so following the docs does not seem to be working...


I do not know how to work around this error, any suggestions



are there any good write ups on how to install geos on ubuntu?



Answer



It is most definitely a problem with the preprocessor not finding a function in platform.h. I might have an answer to the problem.


The ISNAN macro/function was moved to into the standard namespace when using cmath.h instead of math.h. Related


This commit allowed the preprocessor to find the right function for the macro definition. This is the result of this issue.


I am not certain when this change was deployed but there is a work around in the notes for the issue. You need to explicitly tell g++ to use the '98 standard at configure time.



Work-around by setting:


export CXX="g++ -std=c++98"


before running ./configure (without the patch, from the release tarball).




This is valid assuming you are using the newest GCC/G++ and using the older library as you have described. If you can, use the newest library version as tinylyx has described that seemingly builds correctly.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...