diff --git a/newsfragments/4389.fixed.md b/newsfragments/4389.fixed.md new file mode 100644 index 00000000000..6702efd3a75 --- /dev/null +++ b/newsfragments/4389.fixed.md @@ -0,0 +1 @@ +Fix invalid library search path `lib_dir` when cross-compiling. diff --git a/pyo3-build-config/src/impl_.rs b/pyo3-build-config/src/impl_.rs index 571f9cb5a0c..ec65259115f 100644 --- a/pyo3-build-config/src/impl_.rs +++ b/pyo3-build-config/src/impl_.rs @@ -1438,7 +1438,10 @@ fn cross_compile_from_sysconfigdata( ) -> Result> { if let Some(path) = find_sysconfigdata(cross_compile_config)? { let data = parse_sysconfigdata(path)?; - let config = InterpreterConfig::from_sysconfigdata(&data)?; + let mut config = InterpreterConfig::from_sysconfigdata(&data)?; + if let Some(cross_lib_dir) = cross_compile_config.lib_dir_string() { + config.lib_dir = Some(cross_lib_dir) + } Ok(Some(config)) } else {