Skip to content

BUG: Function signature mismatch: random_multinomial #24490

@allsey87

Description

@allsey87

Describe the issue:

When I try to statically link NumPy to Pyodide, it works fine, but I am getting a warning about two conflicting definitions for random_multinomial.

Error message:

wasm-ld: warning: function signature mismatch: random_multinomial
>>> defined as (i32, i64, i32, i32, i32, i32) -> void in dist/libnumpy.a(_generator.o)
>>> defined as (i32, i32, i32, i32, i32, i32) -> void in dist/libnumpy.a(distributions.o)

Context for the issue:

@hoodmane did some investigation on this in pyodide/pyodide#4083 and concluded that:

_generator.o imports random_multinomial with type (i32, i64, i32, i32, i32, i32) -> nil and distributions.o defines it with type (i32, i32, i32, i32, i32, i32) -> nil. It seems to be that the type of RAND_INT_TYPE is controlled by the environment variable NP_RANDOM_LEGACY. If NP_RANDOM_LEGACY is defined to be 1, then it's defined to be long which is probably 32 bits on wasm32. Otherwise, it's defined to be int64. But numpy/random/c_distributions.pxd unconditionally declares it as int64. This is probably best regarded as a bug in numpy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions