Skip to content

BUG: Compiling C extension against numpy 2.0.1 fails with error: 'I' undeclared #27083

@duncanmmacleod

Description

@duncanmmacleod

Describe the issue:

Attempting to build the gstlal-inspiral package (C modules, C extension modules, and pure Python modules built using autotools) fails in compiling a C extension module, in an environment with numpy 2.0.1 with:

/home/conda/feedstock_root/build_artifacts/gstlal-inspiral_1722339059186/work/python/_spawaveform.c: In function 'SPAWaveformReduceSpin':
/home/conda/feedstock_root/build_artifacts/gstlal-inspiral_1722339059186/work/python/_spawaveform.c:585:55: error: 'I' undeclared (first use in this function)
  585 |         hOfF[k] = amp * (cos(Psi+shft*f+phi0+piBy4) - I*sin(Psi+shft*f+phi0+piBy4));
      |                                                    

The I in question is supposed to be that provided by complex.h.

This was briefly discussed here (and replies).

Reproduce the code example:

n/a

The source code for the extension module in question is here.

Error message:

/home/conda/feedstock_root/build_artifacts/gstlal-inspiral_1722339059186/work/python/_spawaveform.c: In function 'SPAWaveformReduceSpin':
/home/conda/feedstock_root/build_artifacts/gstlal-inspiral_1722339059186/work/python/_spawaveform.c:585:55: error: 'I' undeclared (first use in this function)
  585 |         hOfF[k] = amp * (cos(Psi+shft*f+phi0+piBy4) - I*sin(Psi+shft*f+phi0+piBy4));
      |

Python and NumPy Versions:

Python 3.10.4
Numpy 2.0.1

Runtime Environment:

No response

Context for the issue:

This briefly prevented forward motion on conda-forge/gstlal-inspiral-feedstock#24 (until the addition of a patch) (that build is eventually foiled by other issues, but the fundamental problem here stands independently, I think).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions