Ticket #1854 (closed bug: fixed)

Opened 4 years ago

Last modified 4 years ago

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:
Platform Version: 10.5.7 Platform: OS X
Must Fix for Release: Yes 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

  Changed 4 years ago by kyngchaos

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

  Changed 4 years ago by kyngchaos

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

  Changed 4 years ago by gsherman

Cmake build works fine on OS X for me at r11242

  Changed 4 years ago by kyngchaos

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.

  Changed 4 years ago by jctull

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.

  Changed 4 years ago by kyngchaos

... 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?

follow-up: ↓ 8   Changed 4 years ago by jctull

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   Changed 4 years ago by kyngchaos

[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.

  Changed 4 years ago by mhugent

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

  Changed 4 years ago by kyngchaos

...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

  Changed 4 years ago by kyngchaos

... 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.

  Changed 4 years ago by mhugent

  • status changed from new to closed
  • resolution set to fixed

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.