GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #1416 from Czaki/poerty_problem · pypa/cibuildwheel@7f6fe8a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs
    • faq.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/faq.md‎

Copy file name to clipboardExpand all lines: docs/faq.md
+34-20Lines changed: 34 additions & 20 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -20,61 +20,75 @@ Linux wheels are built in [`manylinux`/`musllinux` containers](https://github.co
2020

2121
### Building macOS wheels for Apple Silicon {: #apple-silicon}
2222

23-
`cibuildwheel` supports cross-compiling `universal2` and `arm64` wheels on `x86_64` runners. With the introduction of Apple Silicon, you now have several choices for wheels for Python 3.8+:
23+
`cibuildwheel` supports cross-compiling `universal2` and `arm64` wheels on `x86_64` runners.
2424

25-
#### `x86_64`
25+
#### Overview of Mac architectures
26+
27+
With the introduction of Apple Silicon, you now have several choices for wheels for Python 3.8+:
28+
29+
##### `x86_64`
2630

2731
The traditional wheel for Apple, loads on Intel machines, and on
2832
Apple Silicon when running Python under Rosetta 2 emulation.
2933

3034
Due to a change in naming, Pip 20.3+ (or an installer using packaging 20.5+)
3135
is required to install a binary wheel on macOS Big Sur.
3236

33-
#### `arm64`
37+
##### `arm64`
3438

3539
The native wheel for macOS on Apple Silicon.
3640

3741
Requires Pip 20.3+ (or packaging 20.5+) to install.
3842

39-
#### `universal2`
43+
##### `universal2`
4044

4145
This wheel contains both architectures, causing it to be up to twice the
4246
size (data files do not get doubled, only compiled code). It requires
4347
Pip 20.3 (Packaging 20.6+) to load on Intel, and Pip 21.0.1 (Packaging 20.9+)
4448
to load on Apple Silicon.
4549

46-
!!! note
47-
The dual-architecture `universal2` has a few benefits, but a key benefit
48-
to a universal wheel is that a user can bundle these wheels into an
49-
application and ship a single binary.
50+
The dual-architecture `universal2` has a few benefits, but a key benefit
51+
to a universal wheel is that a user can bundle these wheels into an
52+
application and ship a single binary.
5053

51-
However, if you have a large library, then you might prefer to ship
52-
the two single-arch wheels instead - `x86_64` and `arm64`. In rare cases,
53-
you might want to build all three, but in that case, pip will not download
54-
the universal wheels, because it prefers the most specific wheel
55-
available.
54+
However, if you have a large library, then you might prefer to ship
55+
the two single-arch wheels instead - `x86_64` and `arm64`. In rare cases,
56+
you might want to build all three, but in that case, pip will not download
57+
the universal wheels, because it prefers the most specific wheel
58+
available.
59+
60+
#### What to provide?
5661

5762
Generally speaking, because Pip 20.3 is required for the `universal2` wheel,
5863
most packages should provide both `x86_64` and one of `universal2`/`arm64`
59-
wheels for now. When Pip 20.3+ is common on macOS, then it might be possible
60-
to ship only the `universal2` wheel.
64+
wheels. When Pip 20.3+ is common on macOS, then it might be possible to ship
65+
only the `universal2` wheel.
66+
67+
Opinions vary on which of arch-specific or `universal2` wheels are best - some packagers prefer `universal2` because it's one wheel for all Mac users, so simpler, and easier to build into apps for downstream users. However, because they contain code for both architectures, their file size is larger, meaning they consume more disk space and bandwidth, and are harder to build for some projects.
68+
69+
See [GitHub issue 1333](https://github.com/pypa/cibuildwheel/issues/1333) for more discussion.
6170

62-
**Apple Silicon wheels are not built by default on Intel runners**, but can be enabled by adding extra archs to the [`CIBW_ARCHS_MACOS` option](options.md#archs) - e.g. `x86_64 arm64`. Cross-compilation is provided by the Xcode toolchain.
71+
#### How to cross-compile
72+
73+
With the exception of Cirrus CI, macOS CI runners are still Intel-based, and Apple Silicon wheels are not built by default on Intel runners. However, cross-compilation can be enabled by adding extra archs to the [`CIBW_ARCHS_MACOS` option](options.md#archs) - e.g. `x86_64 arm64`. Cross-compilation is provided by the Xcode toolchain.
6374

6475
!!! important
6576
When cross-compiling on Intel, it is not possible to test `arm64` and the `arm64` part of a `universal2` wheel.
6677

6778
`cibuildwheel` will raise a warning to notify you of this - these warnings be be silenced by skipping testing on these platforms: `CIBW_TEST_SKIP: *_arm64 *_universal2:arm64`.
6879

69-
Hopefully, cross-compilation is a temporary situation. Once we have widely
70-
available Apple Silicon CI runners, we can build and test `arm64` and
71-
`universal2` wheels natively. That's why `universal2`/`arm64` wheels require opt-in by setting `CIBW_ARCHS_MACOS`.
72-
7380
!!! note
7481
Your runner needs Xcode Command Line Tools 12.2 or later to build `universal2` or `arm64`.
7582

7683
Only CPython 3.8 and newer support `universal2` and `arm64` wheels.
7784

85+
!!! note
86+
If your project uses **Poetry** as a build backend, cross-compiling on macOS [does not currently work](https://github.com/python-poetry/poetry/issues/7107). In some cases arm64 wheels can be built but their tags will be incorrect, with the platform tag showing `x86_64` instead of `arm64`.
87+
88+
As a workaround, the tag can be fixed before running delocate to repair the wheel. The [`wheel tags`](https://wheel.readthedocs.io/en/stable/reference/wheel_tags.html) command is ideal for this. See [this workflow](https://gist.github.com/anderssonjohan/49f07e33fc5cb2420515a8ac76dc0c95#file-build-pendulum-wheels-yml-L39-L53) for an example usage of `wheel tags`.
89+
90+
Hopefully, cross-compilation is a temporary situation. Once we have widely available Apple Silicon CI runners, we can build `arm64` wheels natively. Until then, cross-compiling `arm64` or `universal2` wheels requires opt-in by setting `CIBW_ARCHS_MACOS` on Intel runners.
91+
7892
Here's an example GitHub Actions workflow with a job that builds for Apple Silicon:
7993

8094
> .github/workflows/build_macos.yml

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.