-
-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
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.oimports random_multinomial with type(i32, i64, i32, i32, i32, i32) -> nilanddistributions.odefines it with type(i32, i32, i32, i32, i32, i32) -> nil. It seems to be that the type ofRAND_INT_TYPEis controlled by the environment variableNP_RANDOM_LEGACY. IfNP_RANDOM_LEGACYis 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. Butnumpy/random/c_distributions.pxdunconditionally declares it as int64. This is probably best regarded as a bug in numpy.