From 1d7ad9da746fb252bb9c23e76c5df4a36c616c2a Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 19 Dec 2023 20:23:01 +0800 Subject: [PATCH] Reject `-i python` when cross compiling (#1891) --- src/build_options.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/build_options.rs b/src/build_options.rs index dfa159c92..d05c2be84 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -316,6 +316,16 @@ impl BuildOptions { } interpreters = find_interpreter_in_sysconfig(interpreter, target, requires_python)?; + if interpreters.is_empty() { + bail!( + "Couldn't find any python interpreters from '{}'. Please check that both major and minor python version have been specified in -i/--interpreter.", + interpreter + .iter() + .map(|p| p.display().to_string()) + .collect::>() + .join(", ") + ); + } } } else if binding_name.starts_with("pyo3") { // Only pyo3/pyo3-ffi bindings supports bundled sysconfig interpreters