Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Sep 11, 2020
Merged

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

merged 2 commits into from
Sep 11, 2020

Conversation

thatcr
Copy link

@thatcr thatcr commented Sep 11, 2020

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