diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a0a9770..3014c019 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Added +- Fix `build.rs` to work with Anaconda python - Add FFI definitions `Py_FinalizeEx`, `PyOS_getsig`, `PyOS_setsig`. [#1021](https://github.com/PyO3/pyo3/pull/1021) - Add `Python::with_gil` for executing a closure with the Python GIL. [#1037](https://github.com/PyO3/pyo3/pull/1037) - Implement `Debug` for `PyIterator`. [#1051](https://github.com/PyO3/pyo3/pull/1051) diff --git a/build.rs b/build.rs index 04ea5a47..9a61050e 100644 --- a/build.rs +++ b/build.rs @@ -680,9 +680,15 @@ import platform import struct import sys import sysconfig +import os.path PYPY = platform.python_implementation() == "PyPy" +# Anaconda based python distributions have a static python executable, but include +# the shared library. Use the shared library for embedding to avoid rust trying to +# LTO the static library (and failing with newer gcc's, because it is old). +ANACONDA = os.path.exists(os.path.join(sys.prefix, 'conda-meta')) + try: base_prefix = sys.base_prefix except AttributeError: @@ -697,7 +703,7 @@ if libdir is not None: print("libdir", libdir) print("ld_version", sysconfig.get_config_var('LDVERSION') or sysconfig.get_config_var('py_version_short')) print("base_prefix", base_prefix) -print("shared", PYPY or bool(sysconfig.get_config_var('Py_ENABLE_SHARED'))) +print("shared", PYPY or ANACONDA or bool(sysconfig.get_config_var('Py_ENABLE_SHARED'))) print("executable", sys.executable) print("calcsize_pointer", struct.calcsize("P")) "#;