Cross compilation#

Cross compilation is a complex topic, we only add some hopefully helpful hints here (for now). As of May 2023, cross-compilation based on crossenv is known to work, as used (for example) in conda-forge. Cross-compilation without crossenv requires some manual overrides. You instruct these overrides by passing options to meson setup via meson-python.

All distributions that are known to successfully cross compile NumPy are using python -m build (pypa/build), but using pip for that should be possible as well. Here are links to the NumPy “build recipes” on those distros:

See also Meson’s documentation on cross compilation to learn what options you may need to pass to Meson to successfully cross compile.

One possible hiccup is that the build requires running a compiled executable in order to determine the long double format for the host platform. This may be an obstable, since it requires crossenv or QEMU to run the host (cross) Python. To avoid this problem, specify the paths to the relevant directories in your cross file:

[properties]
longdouble_format = 'IEEE_DOUBLE_LE'

For more details and the current status around cross compilation, see: