From 2f74ab0d236c5568175b8caf6797801b6c6ac8f4 Mon Sep 17 00:00:00 2001 From: Sergey Kvachonok Date: Tue, 21 Sep 2021 16:22:33 +0300 Subject: [PATCH] build-config: Always pass `abi3` flag to `default_lib_name_windows()` Hardcoding `false` here leads to an incorrect abi3 DLL name when cross-compiling to Windows. --- CHANGELOG.md | 1 + pyo3-build-config/src/impl_.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d20ffccdc2c..c7be6095cb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix building with a conda environment on Windows. [#1873](https://github.com/PyO3/pyo3/pull/1873) - Fix panic on Python 3.6 when calling `Python::with_gil` with Python initialized but threading not initialized. [#1874](https://github.com/PyO3/pyo3/pull/1874) +- Fix incorrect linking to version-specific DLL instead of `python3.dll` when cross-compiling to Windows with `abi3`. [#1880](https://github.com/PyO3/pyo3/pull/1880) ## [0.14.5] - 2021-09-05 diff --git a/pyo3-build-config/src/impl_.rs b/pyo3-build-config/src/impl_.rs index 1bc0fb3d97b..a2689ae90a5 100644 --- a/pyo3-build-config/src/impl_.rs +++ b/pyo3-build-config/src/impl_.rs @@ -982,12 +982,14 @@ fn windows_hardcoded_cross_compile( let version = cross_compile_config.version.or_else(get_abi3_version) .ok_or("PYO3_CROSS_PYTHON_VERSION or an abi3-py3* feature must be specified when cross-compiling for Windows.")?; + let abi3 = is_abi3(); + Ok(InterpreterConfig { implementation: PythonImplementation::CPython, version, shared: true, - abi3: is_abi3(), - lib_name: Some(default_lib_name_windows(version, false, false)), + abi3, + lib_name: Some(default_lib_name_windows(version, abi3, false)), lib_dir: cross_compile_config.lib_dir.to_str().map(String::from), executable: None, pointer_width: None,