Open zerovirus123 opened 1 year ago
Looks like copysign
is defined as a macro somewhere, possibly in the Python headers. If that's the case, Python should be fixed, IMHO.
It might also be useful to add a workaround to Boost.Python. CC @stefanseefeld.
Check whether your pyconfig.h
file contains #define copysign _copysign
. I can't find such a line in my Python 3.9 installation, only a comment in pymath.h
about it, but it might have been present in 3.7.
@pdimov Hi Peter, I checked pyconfig.h
and the directive is present in Python37.
The easiest fix then is to upgrade to a more recent Python version, one that no longer has the #define
. I'm not sure what we can do on the Boost side to defend against that.
@pdimov Python310 has the #define HAVE_COPYSIGN 1 directive. Does that mean that copysign is still defined in the later Python versions.
If I build my Boost library with Python310, then the compiler would not produce the _copysign namespace error.
#define HAVE_COPYSIGN 1
in pyconfig.h just means that the compiler has a copysign
function, which Python can use without needing to redefine copysign
to _copysign
.
I have built Boost_1.76 with the following configurations.
I am compiling the project with the following specs.
The compilation generates the following error.
I looked at
python.hpp
andnumpy.hpp
and could only find a reference tostd::cmath
insideboost\python\detail\wrap_python.py
, which is used overboost::core::cmath
. I checked thestd::cmath
header andcopysign
is neither declared nor defined. How do I make sure that my Boost library uses thecopysign
inboost::core::cmath
?