-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
crypthography cross build produces host's rust library #205807
Comments
FYI @Artturin didn't you work on python cross or am I mistaken your for someone else? |
yeah i did but this is unrelated to python
diff --git a/pkgs/development/python-modules/cryptography/default.nix b/pkgs/development/python-modules/cryptography/default.nix
index 0bbc30cd23c..828e20d7982 100644
--- a/pkgs/development/python-modules/cryptography/default.nix
+++ b/pkgs/development/python-modules/cryptography/default.nix
@@ -4,6 +4,7 @@
, buildPythonPackage
, fetchPypi
, rustPlatform
+, rust
, setuptools-rust
, openssl
, Security
@@ -49,7 +50,7 @@ buildPythonPackage rec {
] ++ [
rustPlatform.cargoSetupHook
setuptools-rust
- ] ++ (with rustPlatform; [ rust.cargo rust.rustc ]);
+ ] ++ (with rustPlatform.rust; [ cargo rustc ]);
buildInputs = [ openssl ]
++ lib.optionals stdenv.isDarwin [ Security libiconv ];
@@ -69,6 +70,11 @@ buildPythonPackage rec {
pytz
];
+ CARGO_BUILD_TARGET = "${rust.toRustTargetSpec stdenv.hostPlatform}";
+
+ PKG_CONFIG_ALLOW_CROSS =
+ if stdenv.buildPlatform != stdenv.hostPlatform then 1 else 0;
+
pytestFlagsArray = [
"--disable-pytest-warnings"
]; |
This seems to be something generic for all python packages with rust extension. I also tried other packages that use Probably somebody skilled with Cargo should look into it. |
I might have gotten a little bit further... diff --git a/pkgs/development/python-modules/cryptography/default.nix b/pkgs/development/python-modules/cryptography/default.nix
index d5e4af33f60..560b8861fdc 100644
--- a/pkgs/development/python-modules/cryptography/default.nix
+++ b/pkgs/development/python-modules/cryptography/default.nix
@@ -2,8 +2,12 @@
, stdenv
, callPackage
, buildPythonPackage
+, python
, fetchPypi
, rustPlatform
+, rust
+, rustc
+, cargo
, setuptools-rust
, openssl
, Security
@@ -47,9 +51,11 @@ buildPythonPackage rec {
nativeBuildInputs = lib.optionals (!isPyPy) [
cffi
] ++ [
- rustPlatform.cargoSetupHook
setuptools-rust
- ] ++ (with rustPlatform; [ rust.cargo rust.rustc ]);
+ rustPlatform.cargoSetupHook
+ rustc
+ cargo
+ ];
buildInputs = [ openssl ]
++ lib.optionals stdenv.isDarwin [ Security libiconv ];
@@ -69,6 +75,9 @@ buildPythonPackage rec {
pytz
];
+ CARGO_BUILD_TARGET = "${rust.toRustTargetSpec stdenv.hostPlatform}";
+ PYO3_CROSS_LIB_DIR = "${python}/lib/${python.libPrefix}";
+
pytestFlagsArray = [
"--disable-pytest-warnings"
]; But still, it fails to build when cross-compiling. For some reason, it can't find linker. |
It seems that I might have crack it. The pull request is here #208401. |
Describe the bug
By attempting to cross-compile python cryptography I get build but rust bindings are build for host architecture.
Steps To Reproduce
Steps to reproduce the behavior:
nix build .#legacyPackages.x86_64-linux.pkgsCross.aarch64-multiplatform.python3Packages.cryptography
file result/lib/python3.10/site-packages/cryptography/hazmat/bindings/_rust.abi3.so
givesx86-64
file result/lib/python3.10/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so
givesaarch64
Expected behavior
The rust should be cross compiled as well.
Additional context
Add any other context about the problem here.
I tried to look into it and discovered this PyO3/setuptools-rust#294 but nothing more.
Notify maintainers
@SuperSandro2000
Metadata
The text was updated successfully, but these errors were encountered: