Skip to content

2.12.1: compilation error with is*() symbols #528

@0-wiz-0

Description

@0-wiz-0

With gcc 12.5.0 (the default) on NetBSD 11.99.2, I see:

c++ -O2 -g -fstack-clash-protection -I/usr/include -I/usr/pkg/include/python3.13 -I/usr/pkg/include -g -I/usr/include -I/usr/pkg/include/python3.13 -I/usr/pkg/include -fPIC -DNPY_TARGET_VERSION=NPY_1_23_API_VERSION -I/us
r/pkg/lib/python3.13/site-packages/numpy/_core/include -I/usr/pkg/include/python3.13 -c numexpr/interpreter.cpp -o build/temp.netbsd-11.99.2-amd64-cpython-313/numexpr/interpreter.o
In file included from /scratch/math/py-numexpr/work/.buildlink/include/python3.13/Python.h:23,
                 from numexpr/module.hpp:13,
                 from numexpr/interpreter.cpp:10:
numexpr/numexpr_config.hpp: In function 'bool isfinitef_(float)':
numexpr/numexpr_config.hpp:54:49: error: expected unqualified-id before '(' token
   54 | inline bool isfinitef_(float x) { return !!std::isfinite(x); }
      |                                                 ^~~~~~~~
numexpr/numexpr_config.hpp: In function 'bool isnanf_(float)':
numexpr/numexpr_config.hpp:55:49: error: expected unqualified-id before '(' token
   55 | inline bool isnanf_(float x)    { return !!std::isnan(x); }
      |                                                 ^~~~~
numexpr/numexpr_config.hpp: In function 'bool isfinited(double)':
numexpr/numexpr_config.hpp:56:49: error: expected unqualified-id before '(' token
   56 | inline bool isfinited(double x) { return !!std::isfinite(x); }
      |                                                 ^~~~~~~~
numexpr/numexpr_config.hpp: In function 'bool isnand(double)':
numexpr/numexpr_config.hpp:57:49: error: expected unqualified-id before '(' token
   57 | inline bool isnand(double x)    { return !!std::isnan(x); }
      |                                                 ^~~~~
numexpr/numexpr_config.hpp: In function 'bool isinff_(float)':
numexpr/numexpr_config.hpp:58:46: error: expected unqualified-id before '(' token
   58 | inline bool isinff_(float x) { return !!std::isinf(x); }
      |                                              ^~~~~
numexpr/numexpr_config.hpp: In function 'bool isinfd(double)':
numexpr/numexpr_config.hpp:59:49: error: expected unqualified-id before '(' token
   59 | inline bool isinfd(double x)    { return !!std::isinf(x); }
      |                                                 ^~~~~

When I add an include of cmath (since this is the header that defines the symbols), I get:

c++ -O2 -g -fstack-clash-protection -I/usr/include -I/usr/pkg/include/python3.13 -I/usr/pkg/include -g -I/usr/include -I/usr/pkg/include/python3.13 -I/usr/pkg/include -fPIC -DNPY_TARGET_VERSION=NPY_1_23_API_VERSION -I/us
r/pkg/lib/python3.13/site-packages/numpy/_core/include -I/usr/pkg/include/python3.13 -c numexpr/interpreter.cpp -o build/temp.netbsd-11.99.2-amd64-cpython-313/numexpr/interpreter.o
In file included from numexpr/module.hpp:17,
                 from numexpr/interpreter.cpp:10:
numexpr/numexpr_config.hpp: In function 'bool isfinitef_(float)':
numexpr/numexpr_config.hpp:55:46: error: '::isfinite' has not been declared; did you mean 'std::isfinite'?
   55 | inline bool isfinitef_(float x) { return !!::isfinite(x); }
      |                                              ^~~~~~~~
      |                                              std::isfinite
In file included from numexpr/numexpr_config.hpp:43:
/usr/include/g++/cmath:578:5: note: 'std::isfinite' declared here
  578 |     isfinite(_Tp __x)
      |     ^~~~~~~~
numexpr/numexpr_config.hpp: In function 'bool isnanf_(float)':
numexpr/numexpr_config.hpp:56:46: error: '::isnan' has not been declared; did you mean 'std::isnan'?
   56 | inline bool isnanf_(float x)    { return !!::isnan(x); }
      |                                              ^~~~~
      |                                              std::isnan
/usr/include/g++/cmath:632:5: note: 'std::isnan' declared here
  632 |     isnan(_Tp __x)
      |     ^~~~~
numexpr/numexpr_config.hpp: In function 'bool isfinited(double)':
numexpr/numexpr_config.hpp:57:46: error: '::isfinite' has not been declared; did you mean 'std::isfinite'?
   57 | inline bool isfinited(double x) { return !!::isfinite(x); }
      |                                              ^~~~~~~~
      |                                              std::isfinite
/usr/include/g++/cmath:578:5: note: 'std::isfinite' declared here
  578 |     isfinite(_Tp __x)
      |     ^~~~~~~~
numexpr/numexpr_config.hpp: In function 'bool isnand(double)':
numexpr/numexpr_config.hpp:58:46: error: '::isnan' has not been declared; did you mean 'std::isnan'?
   58 | inline bool isnand(double x)    { return !!::isnan(x); }
      |                                              ^~~~~
      |                                              std::isnan
/usr/include/g++/cmath:632:5: note: 'std::isnan' declared here
  632 |     isnan(_Tp __x)
      |     ^~~~~
numexpr/numexpr_config.hpp: In function 'bool isinff_(float)':
numexpr/numexpr_config.hpp:59:43: error: '::isinf' has not been declared; did you mean 'std::isinf'?
   59 | inline bool isinff_(float x) { return !!::isinf(x); }
      |                                           ^~~~~
      |                                           std::isinf
/usr/include/g++/cmath:605:5: note: 'std::isinf' declared here
  605 |     isinf(_Tp __x)
      |     ^~~~~
numexpr/numexpr_config.hpp: In function 'bool isinfd(double)':
numexpr/numexpr_config.hpp:60:46: error: '::isinf' has not been declared; did you mean 'std::isinf'?
   60 | inline bool isinfd(double x)    { return !!::isinf(x); }
      |                                              ^~~~~
      |                                              std::isinf
/usr/include/g++/cmath:605:5: note: 'std::isinf' declared here
  605 |     isinf(_Tp __x)
      |     ^~~~~

so I came up with this patch, which fixes the problem for me:

--- numexpr/numexpr_config.hpp.orig     2025-09-14 13:57:31.046041558 +0000
+++ numexpr/numexpr_config.hpp
@@ -40,6 +40,7 @@
 #include "mkl_vml.h"
 #include "mkl_service.h"
 #endif
+#include <cmath>

 #ifdef _WIN32
   #ifndef __MINGW32__
@@ -51,12 +52,12 @@
 msvc_function_stubs contains windows alternatives
 /* Due to casting problems (normally return ints not bools, easiest to define
 non-overloaded wrappers for these functions) */
-inline bool isfinitef_(float x) { return !!::isfinite(x); }
-inline bool isnanf_(float x)    { return !!::isnan(x); }
-inline bool isfinited(double x) { return !!::isfinite(x); }
-inline bool isnand(double x)    { return !!::isnan(x); }
-inline bool isinff_(float x) { return !!::isinf(x); }
-inline bool isinfd(double x)    { return !!::isinf(x); }
+inline bool isfinitef_(float x) { return !!std::isfinite(x); }
+inline bool isnanf_(float x)    { return !!std::isnan(x); }
+inline bool isfinited(double x) { return !!std::isfinite(x); }
+inline bool isnand(double x)    { return !!std::isnan(x); }
+inline bool isinff_(float x) { return !!std::isinf(x); }
+inline bool isinfd(double x)    { return !!std::isinf(x); }
 #endif

 #endif // NUMEXPR_CONFIG_HPP

but I have no wait to test this on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions