Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3: improve cross-compilation of extension modules, fixes #91171 #91178

Merged
merged 2 commits into from Jun 22, 2020

Conversation

FRidh
Copy link
Member

@FRidh FRidh commented Jun 20, 2020

Fixes #91171.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@FRidh FRidh changed the base branch from master to staging June 20, 2020 15:43
@FRidh

This comment has been minimized.

@FRidh

This comment has been minimized.

@FRidh
Copy link
Member Author

FRidh commented Jun 20, 2020

Upstream PR!
python/cpython#7914

@Mic92
Copy link
Member

Mic92 commented Jun 21, 2020

Downside of this approach is that it only works in a nix-build or nix-shell.

This is not really a regression compilers don't work outside the nix-shell anyway.

@FRidh
Copy link
Member Author

FRidh commented Jun 21, 2020

Doesn't mean we need to enforce that shortcoming when we can avoid it.

@Mic92
Copy link
Member

Mic92 commented Jun 21, 2020

Doesn't mean we need to enforce that shortcoming when we can avoid it.

It should be easy enough to whatever one wants to use instead of nix-shell to also just export LDSHARED, CC, and CXX accordingly.

This should no longer be needed with python3 because it's now
set correctly in the interpreter.

Note that the build currently fails with and without this change.
@FRidh
Copy link
Member Author

FRidh commented Jun 21, 2020

Exactly.

So, as it is now cross-compiling pycryptodome succeeds. I also tried btrfs-progs because it exports LDSHARED, but unfortunately that package fails to build with and without the patch in this PR.

@FRidh FRidh added the 6.topic: cross-compilation Building packages on a different sort platform than than they will be run on label Jun 21, 2020
@ofborg ofborg bot requested a review from 7c6f434c June 21, 2020 15:41
@Mic92
Copy link
Member

Mic92 commented Jun 21, 2020

There is a report that btrfs-progs cross-compiles now as of #50925 (comment)

@FRidh FRidh merged commit 9c3a585 into NixOS:staging Jun 22, 2020
@FRidh FRidh deleted the ldshared branch June 22, 2020 06:47
@kvtb
Copy link
Contributor

kvtb commented Jul 10, 2021

@GrahamcOfBorg build pkgsCross.aarch64-multiplatform.python3Packages.pycryptodome

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

Successfully merging this pull request may close these issues.

None yet

3 participants