Bug report #1854

qgisinterpolator.cpp causing build error on OS X

Added by John Tull over 15 years ago. Updated over 15 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Build/Install
Affected QGIS version: Regression?:No
Operating System:OS X Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:11914

Description

From the most current svn, I cannot build successfully on OS X. The error message is:
...
[ 68%] Building CXX object src/plugins/interpolation/CMakeFiles/interpolationplugin.dir/qgstininterpolator.o
/Users/jctull/sources/qgis/trunk/src/plugins/interpolation/qgstininterpolator.cpp: In member function ‘int QgsTINInterpolator::insertData(QgsFeature*, bool, int, QgsInterpolator::InputType)’:
/Users/jctull/sources/qgis/trunk/src/plugins/interpolation/qgstininterpolator.cpp:159: error: ‘isnan’ was not declared in this scope
maker2: * [src/plugins/interpolation/CMakeFiles/interpolationplugin.dir/qgstininterpolator.o] Error 1
maker1:
[src/plugins/interpolation/CMakeFiles/interpolationplugin.dir/all] Error 2
make: *
* [all] Error 2

History

#1 Updated by William Kyngesburye over 15 years ago

I just tried building after 7bc1a64e (SVN r11239), using the Xcode build -- same error.

#2 Updated by William Kyngesburye over 15 years ago

P.S. it's also showing up in qgsinterpolator.cpp.

#3 Updated by Gary Sherman over 15 years ago

Cmake build works fine on OS X for me at 06ce0aa4 (SVN r11243)

#4 Updated by William Kyngesburye over 15 years ago

OK, I see that isnan has been in qgsinterpolator.cpp since February (fixed for OSX in March), and I haven't had a problem with it. Now isnan was added to qgstininterpolator.cpp, and now both of them complain about isnan...

John - I believe you are using Qt 4.5, right? I just updated to Qt 4.5 this weekend (right before 5d9b66fa (SVN r11212), which added isnan to the tin source). And it's interesting that at first I only got 1 isnan error, but after 7bc1a64e (SVN r11239) I got errors in both.

Gary - which Qt version are you using?

That's the only major change in my setup that I can think of.

#5 Updated by John Tull over 15 years ago

William - I was coming to that same realization. I was about to post a similar comment about qt versions as well. I'm using 4.5.2, fwiw.

#6 Updated by William Kyngesburye over 15 years ago

... but then, as I recall you've been using Qt 4.5 for a while, and this is the first time you've had this error? When did you update to 4.5.2 (from 4.5.0 or .1)? When was the last time you compiled Qgis?

#7 Updated by John Tull over 15 years ago

I recall communicating with the dev of this plugin a while back. When it did not get fixed, I removed it from the plugins cmakefile, so I was not trying to build it for some time. I am guessing that the cmakefile changed when the osm plugin was added to the repo over the past week or so. It has been a problem since it was introduced into the codebase, which was after switching to qt-4.5.x, for me. Everything but this compiled fine using your xcode project yesterday. About a week or two ago, prior to that, for my last build.

#8 Updated by William Kyngesburye over 15 years ago

[jef] wrote on the dev list:

http://trac.osgeo.org/geos/ticket/270 might also relate to that.

Does replacing

#include <cmath>

with

#include <math.h>

in src/core/qgis.h help?

...now I'm back to the original error John had, just in tininterpolator. So interpolator is doing something right so that isnan works. Or tininterpolator is including another header that includes <cmath> (the trail was too tangled for me to follow).

As a test, I changed isnan() in tininterpolator to std::isnan() and it compiled. Doing the same for interpolator breaks with:


So there seems to be some sort of namespace issue in tininterpolator, or <cmath> is included somewhere.

#9 Updated by Marco Hugentobler over 15 years ago

I think it is because qgstininterpolator.h includes DualEdgeTriangulation.h and that includes MathUtlis.h (which includes <cmath>).
Could you try to add the ifdef clause

#ifndef Q_OS_MACX
#include <cmath>
#else
#include <math.h>

to MathUtils.h and tell me if it works?

Marco

#10 Updated by William Kyngesburye over 15 years ago

...and in Point3D.h and Vector3D.h. Then it compiles.

Summary: change #include <cmath> in qgis.h, MathUtils.h, Point3D.h and Vector3D.h to:

#ifndef Q_OS_MACX
#include <cmath>
#else
#include <math.h>
#endif

#11 Updated by William Kyngesburye over 15 years ago

... though the qgis.h change is global (the rest of Qgis compilation seems to be OK with it). Everything else in Qgis works with <cmath> for math functions. It would be nice to figure out why only tininterpolation has this problem.

#12 Updated by Marco Hugentobler over 15 years ago

  • Resolution set to fixed
  • Status changed from Open to Closed

I think the '#include <cmath>' in qgis.h is not used anywhere. So I removed it and added the ifdefs in 3ddd1795 (SVN r11275). Please reopen this bug if there are still compile problems with the modifications.

Also available in: Atom PDF