Skip to content

python3Packages.numpy: fix cross compilation#268587

Merged
mweinelt merged 2 commits intoNixOS:stagingfrom
tpwrules:numpy-fix-cross
Nov 24, 2023
Merged

python3Packages.numpy: fix cross compilation#268587
mweinelt merged 2 commits intoNixOS:stagingfrom
tpwrules:numpy-fix-cross

Conversation

@tpwrules
Copy link
Contributor

Description of changes

Fixes cross-compilation that was broken by the recent change to Meson. The fix is kind of a hack, but it works.

meson-python and/or mesonEmulatorHook probably need to be modified to agree better. See also #260637 (comment)

Cross-compiled numpy on master from x86_64-linux to armv7l-linux and it seems to work fine. I ran a bit of the test suite successfully (not patient enough for the whole thing) and was able to generally do numpy stuff without it exploding and dying. I also checked that a native compilation for x86_64-linux still works.

cc @amjoseph-nixpkgs

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
    • armv7l-linux
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

The full path of the build Python intepreter gets stored in
numpy/__config__.py and thus the built wheel. Leaving the reference is
annoying for regular builds but fatal for cross builds.
Add mesonEmulatorHook, along with a small hack to make it function
properly with meson-python.
@github-actions github-actions bot added the 6.topic: python Python is a high-level, general-purpose programming language. label Nov 19, 2023
@tpwrules tpwrules requested a review from mweinelt November 19, 2023 22:28
@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Nov 20, 2023
@ofborg ofborg bot requested a review from FRidh November 20, 2023 02:08
@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Nov 20, 2023
@mweinelt mweinelt merged commit 82afea3 into NixOS:staging Nov 24, 2023
@github-actions
Copy link
Contributor

Successfully created backport PR for staging-23.11:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants