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

Detect compiling from Linux gnu to Linux musl as cross compiling #2010

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

messense
Copy link
Member

The original code logic was derived from pyo3, I don't remember why it does not consider cross-compiling if arch-vendor-os is all the same.

For maturin to correctly use bundled sysconfig Python when compiling from Linux gnu host to Linux musl target, we need to detect it as cross compiling, otherwise it will only find Python interpreters on the host that was compiled for glibc.

cc @davidhewitt

Copy link

netlify bot commented Mar 26, 2024

Deploy Preview for maturin-guide ready!

Name Link
🔨 Latest commit f7c5b79
🔍 Latest deploy log https://app.netlify.com/sites/maturin-guide/deploys/6602dd57bd553200094ae480
😎 Deploy Preview https://deploy-preview-2010--maturin-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@messense messense added the cross-compile Something related to cross compilation label Mar 26, 2024
@davidhewitt
Copy link
Member

I don't remember why it does not consider cross-compiling if arch-vendor-os is all the same.

Probably this was because Windows 32/64bit and macOS arm/x86_64 are somewhat special cases. I wonder whether the logic is backwards though, something to check in PyO3.

@davidhewitt
Copy link
Member

EDIT: rereading, I think my comment above is not relevant.

As far as I was concerned in PyO3 my thinking what that cross compiling is "can't run the target interpreter to discover config". I think Linux gnu systems can run musl binaries (but maybe only if the musl binary is statically linked?)

@messense
Copy link
Member Author

I think Linux gnu systems can run musl binaries (but maybe only if the musl binary is statically linked?)

Yeah, I think currently the only major player is Alpine Linux which is dynamically linked musl libc.

@messense messense merged commit fec8722 into PyO3:main Mar 27, 2024
29 checks passed
@messense messense deleted the musllinux-cross-compile branch March 27, 2024 00:29
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Jun 6, 2024
https://build.opensuse.org/request/show/1178629
by user mia + anag+factory
- Update to 1.6.0
  * Add pypi name validation
    gh#PyO3/maturin#2007
  * Add JSON schema generation
    gh#PyO3/maturin#2005
  * Detect compiling from Linux gnu to Linux musl as cross compiling
    gh#PyO3/maturin#2010
  * Upgrade uniffi to 0.27.0
    gh#PyO3/maturin#2021
  * Add instrumentation support for develop
    gh#PyO3/maturin#2019
  * Make tracing-subscriber mandatory
    gh#PyO3/maturin#2022
  * Import hook upgrade
    gh#PyO3/maturin#2024
  * Add uv as develop backend command
    gh#PyO3/maturin#2015
  * Also try uv in PATH in develop --uv
    gh#PyO3/maturin#2026
  * docs: update pyo3 to match tutorial
    gh#PyO3/maturin#2029
  * Add support for AIX
    gh#PyO3/maturin#2030
  * Remove rust-cpython from project init/new template
    gh#PyO3/maturin#2034
  * Only run uv tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cross-compile Something related to cross compilation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants