Skip to content

Build issue error: ‘__builtin_isnan’ is not a member of ‘std’ #10032

Closed

Description

@johalaoui
System information (version)
  • OpenCV => master 7267e94
  • Operating System / Platform => Ubuntu 17.10
  • Compiler => g++-5 (5.5.0-1ubuntu1)
Detailed description

While building OpenCV I got this error:

[ 78%] Building CXX object modules/photo/CMakeFiles/opencv_photo.dir/src/denoising.cpp.o
In file included from opencv/modules/photo/src/fast_nlmeans_denoising_invoker.hpp:48:0,
                 from opencv/modules/photo/src/denoising.cpp:44:
opencv/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp: In static member function ‘static WT DistAbs::calcWeight_<T, WT>::f(double, const float*, WT)’:
opencv/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp:138:17: error: ‘__builtin_isnan’ is not a member of ‘std’
             if (std::isnan(w)) w = 1.0; // Handle h = 0.0
                 ^
opencv/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp:138:17: note: suggested alternative:
<built-in>: note:   ‘__builtin_isnan’
opencv/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp: In static member function ‘static WT DistSquared::calcWeight_<T, WT>::f(double, const float*, WT)’:
opencv/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp:260:17: error: ‘__builtin_isnan’ is not a member of ‘std’
             if (std::isnan(w)) w = 1.0; // Handle h = 0.0
                 ^
opencv/modules/photo/src/fast_nlmeans_denoising_invoker_commons.hpp:260:17: note: suggested alternative:
<built-in>: note:   ‘__builtin_isnan’
modules/photo/CMakeFiles/opencv_photo.dir/build.make:427: recipe for target 'modules/photo/CMakeFiles/opencv_photo.dir/src/denoising.cpp.o' failed
make[2]: *** [modules/photo/CMakeFiles/opencv_photo.dir/src/denoising.cpp.o] Error 1
CMakeFiles/Makefile2:3602: recipe for target 'modules/photo/CMakeFiles/opencv_photo.dir/all' failed
make[1]: *** [modules/photo/CMakeFiles/opencv_photo.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Steps to reproduce
export CC=/usr/bin/gcc-5 
export CXX=/usr/bin/g++-5
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..

I have replaced std::isnan( with cvIsNaN( and built it without errors. Do you have any suggestions how to build it without modifying the source code?

Activity

  1. alalek commented on Nov 6, 2017

    @alalek
    Member

    There is no such problem with other versions of GCC (4.8.4 / 5.3 / 7.2.1).
    Consider to report this regression to GCC team: https://gcc.gnu.org/bugzilla (they may ask for additional information).

    Ubuntu 17.10 ships GCC 7.x by default - probably there is a problem in your build environment via mixing of incompatible libstdc/stdc++ headers.

    BTW, "google" suggests to add #include <cmath> somewhere.

  2. johalaoui commented on Nov 7, 2017

    @johalaoui
    Author

    This issue was very similar to this one: https://github.com/voidlinux/void-packages/issues/7324#issuecomment-321241340
    I have changed c++config.h and built it without errors.

    --- /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h.bak	2017-11-07 00:53:02.751217575 +0100
    +++ /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h	2017-11-07 01:31:04.506126867 +0100
    @@ -1343,7 +1343,7 @@
     
     /* Define if C99 functions or macros in <math.h> should be imported in <cmath>
        in namespace std. */
    -/* #undef _GLIBCXX_USE_C99_MATH */
    +#define _GLIBCXX_USE_C99_MATH 1
     
     /* Define if C99 functions or macros in <math.h> should be imported in
        <tr1/cmath> in namespace std::tr1. */
    
    
  3. eguoguo321 commented on Jan 17, 2020

    @eguoguo321

    This issue was very similar to this one: https://github.com/voidlinux/void-packages/issues/7324#issuecomment-321241340
    I have changed c++config.h and built it without errors.

    --- /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h.bak	2017-11-07 00:53:02.751217575 +0100
    +++ /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h	2017-11-07 01:31:04.506126867 +0100
    @@ -1343,7 +1343,7 @@
     
     /* Define if C99 functions or macros in <math.h> should be imported in <cmath>
        in namespace std. */
    -/* #undef _GLIBCXX_USE_C99_MATH */
    +#define _GLIBCXX_USE_C99_MATH 1
     
     /* Define if C99 functions or macros in <math.h> should be imported in
        <tr1/cmath> in namespace std::tr1. */
    

    Thank U VERY MUCH,IT troubles me a lot fo time

  4. added a commit that references this issue on Mar 11, 2021
  5. added a commit that references this issue on May 24, 2021
  6. added a commit that references this issue on Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions