Comments (4)
I've been about to post the same issue :)
TLDR: Despite _PYTHON_HOST_PLATFORM
is kind of undocumented variable used in soon-to-be-deprecated-distutils I also think it could be the easiest way to fix tags for cross-compiled wheels.
Long version:
Re: #2102 (comment) and #2103.
According to PEP-730 and PEP-738 wheels tags should be:
Android:
android_21_arm64_v8a
android_21_armeabi_v7a
android_21_x86_64
android_21_x86
iOS:
ios_12_0_arm64_iphoneos
ios_12_0_arm64_iphonesimulator
ios_12_0_x86_64_iphonesimulator
This should be the value returned by sysconfig.get_platform()
(with _
replaced to -
).
After looking at Maturin code base I see there are at least two ways for that value to get into the program:
CARGO_BUILD_TARGET
variable (or--target
option).target.detect_arch_from_python()
method
CARGO_BUILD_TARGET
expects a valid triple in the format {arch}-{vendor}-{os}[-env]
, so neither android_21_arm64_v8a
, not ios_12_0_arm64_iphoneos
won't work there.
On the other hand detect_arch_from_python()
is currently tailored to macOS
only (btw, python interpreter detection code refuses executable name without a version on the end - could be fixed as well). We could, potentially, add checks/parsing for iOS and Android, but Target
structure would need to be extended with os_ver
(or something) field to store 12.0
for iOS and 21
for Android. Also, build_context.get_platform_tag()
would need to be improved to handle iOS and Android OSes.
So, checking _PYTHON_HOST_PLATFORM
and using it for a wheel tag would be an easiest way to satisfy custom tags requirements :)
I can try implementing that and submit a PR.
from maturin.
Pull requests are welcome!
On the other hand
detect_arch_from_python()
is currently tailored tomacOS
only
Don't worry about this one, it's only for native macOS compilation.
from maturin.
@messense what do you think about #2122? I don't have much experience with Rust, please let me know if it could be made more elegantly.
The implementation is that easy indeed, worked like a charm for us.
from maturin.
#2122 looks good to me, thanks!
from maturin.
Related Issues (20)
- Incompatible with conda or venv, with error "markers XXX don't match your environment" HOT 5
- Add a way to override the resultant Python package version HOT 1
- `cargo metadata --manifest-path Cargo.toml --format-version 1 --locked` errors on macos-12 builds HOT 7
- can't find crate `num_enum_derive` HOT 11
- Gentoo Linux: dev-util/maturin-1.7.0 QA Notice: setuptools warnings detected: `install_requires` overwritten in `pyproject.toml` (dependencies)
- Cannot publish projects to PyPi HOT 1
- Move maturin project metadata from `setup.py` to `pyproject.toml`
- wheel `License-File` metadata is missing the relative path `license_files/`
- Make CI faster and more reliable
- Update to latest cargo deny release
- `--uv` does not allow passing in `--break-system-packages` on system Python HOT 3
- How can I specify a crate version for maturin to compile? HOT 1
- maturin develop builds for mixed python versions HOT 1
- Panic running sdist when `python-source` points outside of Rust source directory HOT 2
- Cross compilation issues with several architectures with Yocto Project
- iOS simulator linking: symbol(s) not found for architecture arm64 HOT 2
- Add -r flag explanation for release builds in Maturin quickstart guide HOT 1
- Copy `.pdb` files to `Editable Installations` and `Wheel`s for easier debugging on windows HOT 4
- msys2: whl is not a supported wheel on this platform. HOT 13
- cannot open shared object file: No such file or directory HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from maturin.