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

Better cross compiling support for PyO3 binding on Unix #454

Merged
merged 3 commits into from
May 6, 2021

Conversation

messense
Copy link
Member

Fixes #446

I've tested it in https://github.com/messense/manylinux2014-cross-arm/actions/runs/605207408 and verified the built wheels with Docker.

@messense
Copy link
Member Author

The sysconfigdata parsing code is mostly copied from pyo3's build.rs with some minor adjustments. I'm not sure whether it's better to extract a shared crate for this. cc @davidhewitt

@messense messense force-pushed the pyo3-cross branch 5 times, most recently from 41845d5 to fce0f3d Compare February 27, 2021 10:54
@@ -469,6 +514,39 @@ fn split_extra_args(given_args: &[String]) -> Result<Vec<String>> {
Ok(splitted_args)
}

fn is_cross_compiling(target: &Target) -> Result<bool> {
Copy link
Member Author

Choose a reason for hiding this comment

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

This function diverges a lot from the pyo3 version because it's not used in build script and have no access to some build time environment variables.

@messense messense force-pushed the pyo3-cross branch 2 times, most recently from 6373e84 to 55a45dd Compare February 27, 2021 13:49
@davidhewitt
Copy link
Member

I'm not sure whether it's better to extract a shared crate for this.

Interesting question. I'd been looking at refactoring pyo3's configuration into a shared crate previously, though I hadn't quite finished up a design. I can try to push what I have at some point over the next week.

Base automatically changed from master to main March 16, 2021 16:22
@davidhewitt
Copy link
Member

Btw I haven't forgotten about this - what I was thinking of above is what I've described on PyO3/pyo3#1548

My branch that I was originally trying out is now a bit outdated because there have been a lot of improvements to the pyO3 build.rs recently. If you think what I propose in that issue is useful here then I'm happy to remake it.

@konstin
Copy link
Member

konstin commented May 6, 2021

Should I review this or should I wait for changes in pyo3?

@messense
Copy link
Member Author

messense commented May 6, 2021

Should I review this or should I wait for changes in pyo3?

I think we can push this to finish line without waiting for changes in pyo3, it just means some duplicated code between maturin and pyo3, we can refactor it later and maybe extract a shared crate out of them.

@konstin
Copy link
Member

konstin commented May 6, 2021

Please move the bulk of the cross compiling logic to a new cross_compile.rs, otherwise the code looks good!

@messense messense merged commit 4cc02a6 into PyO3:main May 6, 2021
@messense messense deleted the pyo3-cross branch May 6, 2021 16:30
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request May 22, 2021
https://build.opensuse.org/request/show/894986
by user mia + dimstar_suse
- Update to 0.10.6
  * Fix build with the “upload” feature disabled by ravenexp
    gh#PyO3/maturin#548
- Changes in 0.10.5:
  * Add manylinux_2_27 support
    gh#PyO3/maturin#521
  * Add support for Windows arm64 target
    gh#PyO3/maturin#524
  * Always output PEP 600 platform tags
    gh#PyO3/maturin#525
  * Fix missing PyInit_<module_name> warning with Rust submodule
    gh#PyO3/maturin#528
  * Better cross compiling support for PyO3 binding on Unix
    gh#PyO3/maturin#454
  * Fix s390x architecture support
    gh#PyO3/maturin#530
  * Fix auditwheel panic with s390x wheels
    gh#PyO3/maturin#532
  * Support uploading heterogenous wheels by ravenexp
    gh#PyO3/maturin#544
  * Warn about pyproject.toml missing maturin version constraint
    gh#PyO3/maturin#545
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.

Cross compilation ignores PYO3_CROSS_PYTHON_VERSION
3 participants