{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "building:cross_compilation",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Cross compilation is a complex topic, we only add some hopefully helpful hints here (for now). As of May 2025, cross-compilation with a Meson cross file as well as cross-compilation based on "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "crossenv"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are known to work. Conda-forge uses the latter method. Cross-compilation without "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "crossenv"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " requires passing build options to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "meson setup"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " via "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "meson-python"
                }
              ],
              "url": "https://mesonbuild.com/meson-python/",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "meson-python"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "All distributions that are known to successfully cross compile NumPy are using "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "python -m build"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "pypa/build"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), but using "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "pip"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for that should be possible as well. Here are links to the NumPy \"build recipes\" on those distros:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Link",
                      "__tag": 4049,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Void Linux"
                        }
                      ],
                      "url": "https://github.com/void-linux/void-packages/blob/master/srcpkgs/python3-numpy/template",
                      "title": ""
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Link",
                      "__tag": 4049,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Nix"
                        }
                      ],
                      "url": "https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/python-modules/numpy",
                      "title": ""
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Link",
                      "__tag": 4049,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Conda-forge"
                        }
                      ],
                      "url": "https://github.com/conda-forge/numpy-feedstock/blob/main/recipe/build.sh",
                      "title": ""
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "See also "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Meson's documentation on cross compilation"
                }
              ],
              "url": "https://mesonbuild.com/Cross-compilation.html",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to learn what options you may need to pass to Meson to successfully cross compile."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "One possible hiccup is that the build requires running a compiled executable in order to determine the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "long double"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " format for the host platform. This may be an obstacle, since it requires "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "crossenv"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or QEMU to run the host (cross) Python. To avoid this problem, specify the paths to the relevant directories in your "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "cross file"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ":"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "[properties]\nlongdouble_format = 'IEEE_DOUBLE_LE'",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For an example of a cross file needed to cross-compile NumPy, see "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "numpy#288861"
                }
              ],
              "url": "https://github.com/numpy/numpy/issues/28861#issuecomment-2844257091",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Putting that together, invoking a cross build with such a cross file, looks like:"
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "$ python -m build --wheel -Csetup-args=\"--cross-file=aarch64-myos-cross-file.txt\"",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "For more details and the current status around cross compilation, see:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The state of cross compilation in Python:   "
                    },
                    {
                      "__type": "Link",
                      "__tag": 4049,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "pypackaging-native key issue page"
                        }
                      ],
                      "url": "https://pypackaging-native.github.io/key-issues/cross_compilation/",
                      "title": ""
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The "
                    },
                    {
                      "__type": "Link",
                      "__tag": 4049,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "set of NumPy issues with the \"Cross compilation\" label"
                        }
                      ],
                      "url": "https://github.com/numpy/numpy/issues?q=state%3Aclosed%20label%3A%2238%20-%20Cross%20compilation%22",
                      "title": ""
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Tracking issue for SciPy cross-compilation needs and issues:   "
                    },
                    {
                      "__type": "Link",
                      "__tag": 4049,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "scipy#14812"
                        }
                      ],
                      "url": "https://github.com/scipy/scipy/issues/14812",
                      "title": ""
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Cross compilation"
        }
      ],
      "level": 0,
      "target": null
    }
  ],
  "local_refs": []
}