Skip to content

Fix cargo test with Anaconda python, and divergent gcc versions.#1175

Merged
davidhewitt merged 2 commits intoPyO3:masterfrom
arrjaytee:thatcr-fix-anaconda-python
Sep 11, 2020
Merged

Fix cargo test with Anaconda python, and divergent gcc versions.#1175
davidhewitt merged 2 commits intoPyO3:masterfrom
arrjaytee:thatcr-fix-anaconda-python

Conversation

@arrjaytee
Copy link

This change forces pyo3 to use python from a shared library when using Anaconda python distributions. Currently cargo test fails with:

= note: lto1: fatal error: bytecode stream in file '.../target/debug/deps/libpyo3-90ae49a6516fe776.rlib' generated with LTO version 6.0 instead of the expected 8.1
          compilation terminated.

unless you match the gcc version with Anaconda's.

Anaconda includes both static and shared versions of python however the python executable is static, so build.rs pyo3 embeds the libpython*.a file, built with Anaconda's gcc 7.3.

This causes the tests and downstream crates to see it also and breaks builds where a different version of gcc is used as the LTO versions in the archive become unsupported.

With this change we always use the .so and avoid any embedded LTO issues altogether.

Copy link
Contributor

@gilescope gilescope left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This was referenced Sep 11, 2020
@davidhewitt
Copy link
Member

🚀 thanks very much for this!

@davidhewitt davidhewitt merged commit e3408e8 into PyO3:master Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants