python3Packages.setuptools-rust: fix cross build for all setuptools-rust based packages#467817
python3Packages.setuptools-rust: fix cross build for all setuptools-rust based packages#467817dotlambda merged 1 commit intoNixOS:stagingfrom
setuptools-rust based packages#467817Conversation
|
Commit messages should probably start with |
a31168d to
09d999f
Compare
09d999f to
40c1e0e
Compare
setuptools-rust based packagessetuptools-rust based packages
40c1e0e to
ffc0702
Compare
…rust` based packages Prior to this change all python packages using `setuptools-rust` were broken when cross compiled as they built binaries for the build platform instead of for the host platform. The setuptoolsRustBuildHook hook would have to be included as a native build input instead of the `setuptools-rust` package, but practically wasn't used anywhere. This change makes it so that `setuptoolsRustBuildHook` becomes unnecessary, and instead `setuptools-rust` propagates a setup-hook directly setting up the build environment, similar to how cmake does it when included via nativeBuildInputs. This change fixes cross on all packages using `setuptools-rust` as a build-system.
ffc0702 to
e656303
Compare
| null | ||
| else | ||
| replaceVars ./setuptools-rust-hook.sh { | ||
| pyLibDir = "${targetPackages.python3}/lib/${targetPackages.python3.libPrefix}"; |
There was a problem hiding this comment.
The default version of python is incorrectly introduced here, instead of the correct one corresponding to python3Packages.
This is causing python312Packages.bcrypt to fail in staging-next, and potentially other packages, because pyo3 tries to use a higher version than current system, resulting in incompatible symbols.
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] #476822 [2] #467817 (cherry picked from commit aba5e58)
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
|
I think this is the change that broke cross-compiling the linux kernel for (e.g.) armv7 targets. Due to |
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
Commit e656303 (PR NixOS#467817) made `setuptools-rust` work automatically in cross compilation scenarios by replacing `setuptoolsRustBuildHook` with `setuptools-rust.setupHook`. However it mixed cross compilation stage variables in the variables injected (substituted) to the setup hook. The variables injected in this commit are identical to those that were used prior to e656303, but in `setuptoolsRustBuildHook`. Should fix this report: NixOS#467817 (comment)
There was a problem hiding this comment.
The intention of this PR is good and it is mostly well written, but I too encountered the issue quoted below, and #473299 didn't fix it.
I think this is the change that broke cross-compiling the linux kernel for (e.g.) armv7 targets. Due to
ubootToolsbeing used innativeBuildInputsof the kernel derivation, one can reproduce the failure withnix build nixpkgs#pkgsCross.armv7l-hf-multiplatform.pkgsBuildHost.ubootToolsand notice some python bcrypt dependency fails to build. That ends up being because of this line, which pulls inpyopenssl(depends on failing bcrypt). I'm not sure exactly on how this can best be resolved. Is it the fault of this change? Is it being done incorrectly on theubootToolsside?
@DavHau Could you share a nix build command that reproduces the issue you encountered? I can share a command that fails now:
nix build -Lf. pkgsCross.armv7l-hf-multiplatform.buildPackages.python3.pkgs.bcryptPer my review comment below, I open the following:
EDIT: But it is not fully functional. See comments within. It is functional now.
| substitutions = { | ||
| pyLibDir = "${python}/lib/${python.libPrefix}"; | ||
| cargoBuildTarget = stdenv.hostPlatform.rust.rustcTargetSpec; | ||
| cargoLinkerVar = stdenv.hostPlatform.rust.cargoEnvVarTarget; |
There was a problem hiding this comment.
Why didn't you use these variables in the setputools-rust.setupHook?
Commit e656303 (PR NixOS#467817) made `setuptools-rust` work automatically in cross compilation scenarios by replacing `setuptoolsRustBuildHook` with `setuptools-rust.setupHook`. However it mixed cross compilation stage variables in the variables injected (substituted) to the setup hook. The variables injected in this commit are identical to those that were used prior to e656303, but in `setuptoolsRustBuildHook`. Should fix this report: NixOS#467817 (comment)
Commit e656303 (PR NixOS#467817) made `setuptools-rust` work automatically in cross compilation scenarios by replacing `setuptoolsRustBuildHook` with `setuptools-rust.setupHook`. However it broke builds such as: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.buildPackages.python3.pkgs.cryptography ``` As reported here: NixOS#467817 (comment) This adjustment fixes the above build, while also maintaining the following working: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.python3.pkgs.libcst ```
Commit e656303 (PR NixOS#467817) made `setuptools-rust` work automatically in cross compilation scenarios by replacing `setuptoolsRustBuildHook` with `setuptools-rust.setupHook`. However it broke builds such as: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.buildPackages.python3.pkgs.cryptography ``` As reported here: NixOS#467817 (comment) This adjustment fixes the above build, while also maintaining the following working: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.python3.pkgs.libcst ```
Commit e656303 (PR NixOS#467817) made `setuptools-rust` work automatically in cross compilation scenarios by replacing `setuptoolsRustBuildHook` with `setuptools-rust.setupHook`. However it broke builds such as: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.buildPackages.python3.pkgs.cryptography ``` As reported here: NixOS#467817 (comment) This adjustment fixes the above build, while also maintaining the following working: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.python3.pkgs.libcst ```
Commit e656303 (PR NixOS#467817) made `setuptools-rust` work automatically in cross compilation scenarios by replacing `setuptoolsRustBuildHook` with `setuptools-rust.setupHook`. However it broke builds such as: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.buildPackages.python3.pkgs.cryptography ``` As reported here: NixOS#467817 (comment) This adjustment fixes the above build, while also maintaining the following working: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.python3.pkgs.libcst ```
Commit e656303 (PR NixOS#467817) made `setuptools-rust` work automatically in cross compilation scenarios by replacing `setuptoolsRustBuildHook` with `setuptools-rust.setupHook`. However it broke builds such as: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.buildPackages.python3.pkgs.cryptography ``` As reported here: NixOS#467817 (comment) This adjustment fixes the above build, while also maintaining the following working: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.python3.pkgs.libcst ```
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] NixOS#476822 [2] NixOS#467817
Commit e656303 (PR NixOS#467817) made `setuptools-rust` work automatically in cross compilation scenarios by replacing `setuptoolsRustBuildHook` with `setuptools-rust.setupHook`. However it broke builds such as: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.buildPackages.python3.pkgs.cryptography ``` As reported here: NixOS#467817 (comment) This adjustment fixes the above build, while also maintaining the following working: ```sh nix build -Lf. pkgsCross.armv7l-hf-multiplatform.python3.pkgs.libcst ```
Due to an issue [1] in the Python splices uncovered by the setuptools-rust cross compilation fix [2], some dependencies will otherwise fail to build. Unfortunately this actually means losing the tests when the build platform can execute host binaries (such as in `pkgsStatic`), but there's not a lot one can do about this without fixing the Python splicing. [1] #476822 [2] #467817 (cherry picked from commit aba5e58)
Prior to this change all python packages using
setuptools-rustwere broken when cross compiled as they built binaries for the build platform instead of for the host platform.The setuptoolsRustBuildHook hook would have to be included as a native build input instead of the
setuptools-rustpackage, but practically wasn't used anywhere.This change makes it so that
setuptoolsRustBuildHookbecomes unnecessary, and insteadsetuptools-rustpropagates a setup-hook directly setting up the build environment, similar to how cmake does it when included via nativeBuildInputs.This change fixes cross on all packages using
setuptools-rustas a build-system.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.