-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
Cross compilation ignores PYO3_CROSS_PYTHON_VERSION #446
Comments
It'd be nice if maturin can detect cross target Python version like pyo3 does https://github.com/PyO3/pyo3/blob/c02b71fc09017078034394c1f7d7011bddb5fd03/build.rs#L316 |
I guess this is essentially the same issue as #375 because of its poor cross compilation support. |
Unless we require passing extra data, this will require copying (or extracting in a shared crate) of https://github.com/PyO3/pyo3/blob/master/build.rs#L311-L510 For future reference, that part could be used for parsing the version: if let Some(cross_python_version) = env::var_os("PYO3_CROSS_PYTHON_VERSION") {
if bridge == BridgeModel::Bin {
bail!("You can't use PYO3_CROSS_PYTHON_VERSION with bin bindings");
}
let expr = Regex::new(r"(\d+).(\d+)").unwrap();
let capture = expr
.captures(&cross_python_version.to_string_lossy())
.context(format!(
"Invalid PYO3_CROSS_PYTHON_VERSION value (should be a version like 3.10): '{}'",
cross_python_version.to_string_lossy()
));
let context = "Expected a digit";
let major = capture
.get(1)
.unwrap()
.as_str()
.parse::<usize>()
.context(context)?;
let minor = capture
.get(2)
.unwrap()
.as_str()
.parse::<usize>()
.context(context)?;
} |
I have found that you can workaround it by using the same major & minor version of Python for build and target. Eg: rust-cross/manylinux-cross@ef575f9 |
Please provide the following information:
python -V
): host Python 3.9, cross target Python 3.6pip -V
): -pyo3
,rust-cpython
orcffi
): pyo3cargo build
work? yes/
)? -Please list the exact steps required to reproduce your error with all command output and if possible with a repository:
https://github.com/messense/manylinux2014-cross-arm/runs/1975989661?check_suite_focus=true
Set
PYO3_CROSS_PYTHON_VERSION =3.6
andPYO3_CROSS_LIB_DIR
according to https://pyo3.rs/v0.13.2/building_and_distribution.html#cross-compiling , maturin builds fine but producescp39-cp39
wheels instead ofcp36-cp36m
.The text was updated successfully, but these errors were encountered: