0

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?

  • Are you required to use an older version of GEOS? Not sure at which version exactly but ISNAN was moved into the standard namespace and this commit accounted for it at somepoint in v3.4. If you are using the latest version of g++ with old headers, it could be causing the problem. – RomaH Jul 13 '18 at 18:48
1

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.

  • so run this command CXX="g++ -std=c++98" after I unzip geos? – ziggy Jul 16 '18 at 12:42
  • Before or after. You are simply setting environment variables in the shell. Be sure to use the export keyword, otherwise it will not take. Hopefully, this is all you'll need. – RomaH Jul 16 '18 at 12:59
0

The latest version seems (both 3.6.2 and 3.7.0beta1) to work for me with gcc7.x .

wget http://download.osgeo.org/geos/geos-3.7.0beta1.tar.bz2
tar xf geos-3.7.0beta1.tar.bz2
cd geos-3.7.0beta1/
./configure && make

Maybe you can find a newer version that works in http://download.osgeo.org/geos/

(tested with:

$g++ --version
g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0

)

  • will this version work okay for uses in geodjango? – ziggy Jul 16 '18 at 12:41
  • @ziggy from the page you linked, 3.6 should be supported. – tinlyx Jul 16 '18 at 17:29

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.