From 49dbfabad08c6f24a9e56c959465457fa2e8d473 Mon Sep 17 00:00:00 2001 From: Paul-Erwan RIO Date: Sun, 28 Jul 2024 16:05:41 +0200 Subject: [PATCH] fix: use PYO3_CROSS_LIB_DIR value as lib_dir when cross-compiling (#4350) --- pyo3-build-config/src/impl_.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyo3-build-config/src/impl_.rs b/pyo3-build-config/src/impl_.rs index 8813b36cff1..a01409d06b1 100644 --- a/pyo3-build-config/src/impl_.rs +++ b/pyo3-build-config/src/impl_.rs @@ -1405,8 +1405,15 @@ 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)?; // RFC: ignore lib_dir from sysconfig and use one from CrossCompileConfig input ? + let config = if cross_compile_config.lib_dir.is_some() { + InterpreterConfig { + lib_dir: cross_compile_config.lib_dir.as_ref().map(|path| path.display().to_string()), + ..InterpreterConfig::from_sysconfigdata(&data)? + } + } else { + InterpreterConfig::from_sysconfigdata(&data)? + }; Ok(Some(config)) } else {