#3215 closed bug (fixed)
qgsclipper code causes trunk to fail to build on OSX
Reported by: | jctull | Owned by: | jef |
---|---|---|---|
Priority: | critical: causes crash or data corruption | Milestone: | Version 1.7.0 |
Component: | Build/Install | Version: | Trunk |
Keywords: | build fail isnan osx qgsclipper | Cc: | |
Must Fix for Release: | Yes | Platform: | OS X |
Platform Version: | 10.6.5 | Awaiting user input: | no |
Description (last modified by )
In the current trunk, there is a problem with either cmath or isnan, perhaps a non-portable use of isnan, that makes qgis fail to build on OS X systems. This is the current error during the make process:
[ 8%] Building CXX object src/core/CMakeFiles/qgis_core.dir/qgsclipper.cpp.o In file included from /Users/jctull/sources/qgis/trunk/src/core/qgsclipper.cpp:21: /Users/jctull/sources/qgis/trunk/src/core/qgsclipper.h: In static member function ‘static QgsPoint QgsClipper::intersect(double, double, double, double, QgsClipper::Boundary)’: /Users/jctull/sources/qgis/trunk/src/core/qgsclipper.h:271: error: call of overloaded ‘abs(double&)’ is ambiguous /usr/include/stdlib.h:146: note: candidates are: int abs(int) /usr/include/c++/4.2.1/cstdlib:143: note: long int std::abs(long int) /usr/include/c++/4.2.1/cstdlib:174: note: long long int __gnu_cxx::abs(long long int) /Users/jctull/sources/qgis/trunk/src/core/qgsclipper.h:271: error: call of overloaded ‘abs(double&)’ is ambiguous /usr/include/stdlib.h:146: note: candidates are: int abs(int) /usr/include/c++/4.2.1/cstdlib:143: note: long int std::abs(long int) /usr/include/c++/4.2.1/cstdlib:174: note: long long int __gnu_cxx::abs(long long int) make[2]: *** [src/core/CMakeFiles/qgis_core.dir/qgsclipper.cpp.o] Error 1 make[1]: *** [src/core/CMakeFiles/qgis_core.dir/all] Error 2 make: *** [all] Error 2
Attachments (2)
Change History (11)
comment:1 by , 14 years ago
Cc: | added |
---|
comment:2 by , 14 years ago
...although, simply removing the code from 14554 in trunk does not get the code to build. In fact, I jumped the gun. r14554 builds also... If I can pinpoint the code change that leads to the crash (accurately) I will report it here.
comment:3 by , 14 years ago
Cc: | removed |
---|---|
Owner: | changed from | to
Ok, it is r14601 that causes the failure. It looks like the includes were moved around a bit, and that is somehow negatively affecting OSX.
comment:4 by , 14 years ago
I've attached a patch that works for me. This needs to be worked on to define changes specific to OSX, but should suffice for testing purposes. I'm not sure if this will work for systems older than Snow Leopard, so please test.
comment:5 by , 14 years ago
I updated the patch to test for Q_OS_MACX and use std::isnan or std::isinf, so this should be a usable patch for qgis. This still needs testing from older OS's and, possibly, ppc builds.
comment:6 by , 14 years ago
Description: | modified (diff) |
---|
comment:7 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
r14711 should also fix it. Looks like Qt has what we need.
comment:8 by , 14 years ago
There are more places in Qgis that use abs(). Maybe should be changed for consistency? After r14711 I found:
- core/composer/qgscomposeritem.cpp
- core/qgscoordinatereferencesystem.cpp
- core/qgsmaprender.cpp (acually fabs())
- core/qgspoint.cpp (right above changes made in r14711)
- core/spatialindex/geometry/LineSegment.cc (though this seems to be independent of Qt/Qgis)
- core/spatialindex/rtree/Node.cc (same as previous)
- gui/qgsannotationitem.cpp
- plugins/georeferencer/qgsgeoreftransform.cpp
- plugin/grass/qgsgrassselect.cpp
- plugin/grass/qtermwidget/TerminalDisplay.cpp
For older OS X versions, if it's in Qt I think it should be OK. I can test back to 10.5 only. Qt "official" binaries support back to 10.4, but the C++ version is almost identical to 10.5 (4.0.x), if that means anything.
by , 14 years ago
does qgis still build on osx with the attached patch?
comment:9 by , 14 years ago
The math.diff patch applied to r14712 worked fine for me. Thanks for sorting all of this out!
I have verified that this bug was introduced with http://trac.osgeo.org/qgis/changeset/14554 Reverting to r14553 builds fine.