Opened 15 years ago

Closed 15 years ago

#1854 closed bug (fixed)

qgisinterpolator.cpp causing build error on OS X

Reported by: jctull Owned by: nobody
Priority: major: does not work as expected Milestone: Version 1.2.0
Component: Build/Install Version: Trunk
Keywords: qgisinterpolator mac Cc:
Must Fix for Release: Yes Platform: OS X
Platform Version: 10.5.7 Awaiting user input: no

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 make[2]: * [src/plugins/interpolation/CMakeFiles/interpolationplugin.dir/qgstininterpolator.o] Error 1 make[1]: * [src/plugins/interpolation/CMakeFiles/interpolationplugin.dir/all] Error 2 make: * [all] Error 2

Change History (12)

comment:1 by kyngchaos, 15 years ago

I just tried building after r11238, using the Xcode build -- same error.

comment:2 by kyngchaos, 15 years ago

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

comment:3 by gsherman, 15 years ago

Cmake build works fine on OS X for me at r11242

comment:4 by kyngchaos, 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 r11211, which added isnan to the tin source). And it's interesting that at first I only got 1 isnan error, but after r11238 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.

comment:5 by jctull, 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.

comment:6 by kyngchaos, 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?

comment:7 by jctull, 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.

in reply to:  7 comment:8 by kyngchaos, 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:

error: expected unqualified-id before '(' token

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

comment:9 by mhugent, 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

comment:10 by kyngchaos, 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

comment:11 by kyngchaos, 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.

comment:12 by mhugent, 15 years ago

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.