diff --git a/CHANGELOG.md b/CHANGELOG.md index bab7ac812ec..227a9d41cfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] -### Fixed -- Fix missing field in `PyCodeObject` struct (`co_posonlyargcount`) - caused invalid access to other fields in Python >3.7. [#1260](https://github.com/PyO3/pyo3/pull/1260) ### Packaging - Drop support for Python 3.5 (as it is now end-of-life). [#1250](https://github.com/PyO3/pyo3/pull/1250) @@ -28,6 +26,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Remove deprecated ffi definitions `PyUnicode_AsUnicodeCopy`, `PyUnicode_GetMax`, `_Py_CheckRecursionLimit`, `PyObject_AsCharBuffer`, `PyObject_AsReadBuffer`, `PyObject_CheckReadBuffer` and `PyObject_AsWriteBuffer`, which will be removed in Python 3.10. [#1217](https://github.com/PyO3/pyo3/pull/1217) - Remove unused `python3` feature. [#1235](https://github.com/PyO3/pyo3/pull/1235) +### Fixed +- Fix missing field in `PyCodeObject` struct (`co_posonlyargcount`) - caused invalid access to other fields in Python >3.7. [#1260](https://github.com/PyO3/pyo3/pull/1260) +- Fix building for `x86_64-unknown-linux-musl` target from `x86_65-unknown-linux-gnu` host. [#1267](https://github.com/PyO3/pyo3/pull/1267) + ## [0.12.3] - 2020-10-12 ### Fixed - Fix support for Rust versions 1.39 to 1.44, broken by an incorrect internal update to paste 1.0 which was done in PyO3 0.12.2. [#1234](https://github.com/PyO3/pyo3/pull/1234) diff --git a/build.rs b/build.rs index 1d4d78f61ab..57df18d38cf 100644 --- a/build.rs +++ b/build.rs @@ -150,15 +150,34 @@ impl CrossCompileConfig { fn cross_compiling() -> Result> { let target = env::var("TARGET")?; let host = env::var("HOST")?; - if target == host || (target == "i686-pc-windows-msvc" && host == "x86_64-pc-windows-msvc") { + if target == host { + // Not cross-compiling + return Ok(None); + } + + if target == "i686-pc-windows-msvc" && host == "x86_64-pc-windows-msvc" { + // Not cross-compiling to compile for 32-bit Python from windows 64-bit + return Ok(None); + } + + if host.starts_with(&format!( + "{}-{}-{}", + env::var("CARGO_CFG_TARGET_ARCH")?, + env::var("CARGO_CFG_TARGET_VENDOR")?, + env::var("CARGO_CFG_TARGET_OS")? + )) { + // Not cross-compiling if arch-vendor-os is all the same + // e.g. x86_64-unknown-linux-musl on x86_64-unknown-linux-gnu host return Ok(None); } if env::var("CARGO_CFG_TARGET_FAMILY")? == "windows" { - Ok(Some(CrossCompileConfig::both()?)) - } else { - Ok(Some(CrossCompileConfig::lib_only()?)) + // Windows cross-compile uses both header includes and sysconfig + return Ok(Some(CrossCompileConfig::both()?)); } + + // Cross-compiling on any other platform + Ok(Some(CrossCompileConfig::lib_only()?)) } /// A list of python interpreter compile-time preprocessor defines that