Opened 3 years ago
Last modified 3 years ago
#66978 assigned defect
LegacySupport messes up isnan with GCC (and isinfinity): error: 'isnan' was not declared in this scope; did you mean 'std::isnan'
| Reported by: | barracuda156 | Owned by: | cjones051073 (Chris Jones) |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 2.8.1 |
| Keywords: | Cc: | ||
| Port: | legacysupport |
Description
In file included from /opt/local/include/ImageMagick-6/magick/MagickCore.h:78,
from /opt/local/include/ImageMagick-6/Magick++/Include.h:45,
from /opt/local/include/ImageMagick-6/Magick++.h:10,
from magick_types.h:3,
from RcppExports.cpp:4:
/opt/local/include/ImageMagick-6/magick/quantum.h: In function 'MagickCore::Quantum MagickCore::ClampToQuantum(MagickRealType)':
/opt/local/include/ImageMagick-6/magick/magick-type.h:220:20: error: 'isnan' was not declared in this scope; did you mean 'std::isnan'?
220 | # define IsNaN(a) isnan(a)
| ^~~~~
/opt/local/include/ImageMagick-6/magick/magick-type.h:220:20: note: in definition of macro 'IsNaN'
220 | # define IsNaN(a) isnan(a)
| ^~~~~
In file included from /opt/local/include/LegacySupport/cmath:54,
from /opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:100,
from /opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/Rcpp/r/headers.h:62,
from /opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/RcppCommon.h:30,
from /opt/local/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Rcpp/include/Rcpp.h:27,
from magick_types.h:2:
/opt/local/include/gcc12/c++/cmath:632:5: note: 'std::isnan' declared here
632 | isnan(_Tp __x)
| ^~~~~
make: *** [RcppExports.o] Error 1
I am not sure on which side is the error. I got this now trying to build R-magick, but apparently it merely passes ImageMagic headers. Issue with the package upstream: https://github.com/ropensci/magick/issues/369
This is the same error which got R-igraph broken on some configs: https://github.com/igraph/rigraph/issues/669
Any ideas what is going wrong and where?
Change History (3)
comment:1 Changed 3 years ago by barracuda156
| Port: | legacysupport added; ImageMagick removed |
|---|---|
| Summary: | ImageMagick headers conflict with LegacySupport? magick-type.h: error: 'isnan' was not declared in this scope; did you mean 'std::isnan'? → LegacySupport messes up isnan with GCC (and isinfinity): error: 'isnan' was not declared in this scope; did you mean 'std::isnan' |
comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
| Owner: | changed from ryandesign to cjones051073 |
|---|
comment:3 Changed 3 years ago by kencu (Ken)
As mentioned in the original ticket description, see:
https://github.com/igraph/rigraph/issues/669
and this reproducer is mentioned:
https://github.com/igraph/rigraph/issues/669#issuecomment-1426711903
and also this:
https://developers.redhat.com/blog/2016/02/29/why-cstdlib-is-more-complicated-than-you-might-think
This could have something to do with the math modifications in legacysupport... they have been very complicated to sort out exactly correctly. A number of folks have had a stab at it, and there are still issues. There is an open PR to fix an issue with clang building against libstdc++ that is still not fully sorted out after some many weeks.

Okay, I am pretty sure it is
LegacySupportmessing up something. See: https://stackoverflow.com/questions/39130040/cmath-hides-isnan-in-math-h-in-c14-c11 Also: https://sourceware.org/bugzilla/show_bug.cgi?id=19439