-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
Add hardcoded well-known sysconfigs for effortless cross compiling #896
Conversation
✅ Deploy Preview for maturin-guide ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a nice idea to me!
version={major}.{minor} | ||
shared=true | ||
abi3=false | ||
build_flags=WITH_THREAD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nb I think this flag only necessary on Python older than 3.7
} | ||
} | ||
|
||
let mut interpreters = Vec::new(); | ||
if binding_name.starts_with("pyo3") && target.is_unix() && target.cross_compiling() { | ||
if let Some(cross_lib_dir) = std::env::var_os("PYO3_CROSS_LIB_DIR") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there also be a check for PYO3_CONFIG_FILE
env var, and just skip all this if so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that'd be nice, but it's out of scope of this PR, I'll open a new issue to track it.
7566a0d
to
5f67d9a
Compare
5f67d9a
to
205b3dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH i don't understand much about pyo3's current cross compiling logic, but the code looks good.
Does this mean that we can now compile and cross-compile to a specific non-abi3 version on linux and mac without having that version installed?
Yes, that's the goal of this. |
Implements #756 (comment)
With this when cross compiling for non-abi3 Linux wheels, there is no need to supply
PYO3_CROSS_LIB_DIR
anymore and-i pythonX.Y
will just work™️. Internally maturin generates a pyo3 config file based on collected sysconfigs and setPYO3_CONFIG_FILE
env var for pyo3's build script.In theory we can extend the support to most Unix systems,
for example macOS(added macOS in this PR generated from https://github.com/messense/python-sysconfig-collector), but that can be done in its dedicated PRs.