Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
bpo-41100: Support macOS 11 and Apple Silicon #22855
Conversation
We should consider just dropping support for macOS 10.4 here to simplify the code.
This is support for ctypes on macOS/arm64 based on PR 21249 by Lawrence D'Anna (Apple). Changes: - changed __builtin_available tests from 11.0 to 10.15 - added test to setup.py for ffi_closure_alloc and use that in malloc_closure.c - Minor change in the code path for ffi_prep_closure_var (coding style change)
The preprocessor guard in the old version doesn't work, and isn't really needed (10.4 only supported 32-bit code where unsigned long is the same as uint32_t).
This also adds an option to stop building after compiling the 3th-party dependencies, as well as a script for archiving those dependencies. This makes it easier to work on the build. There are three changes to build-installer.py related to universal2 support: 1. Add 'universal2' information to build-installer.py; 2. Building OpenSSL for arm64 requires a patch at this time; 3. For some reason I had to patch the Tcl build to avoid a build error.
Needed because my previous workaround doesn't work anymore. This uses a private API, that should be made public later...
- __builtin_available is not present in the compiler, fall back to the ancient way of testing if a symbol is usable. - Logic error code in pytime.c resulted in a compile error.
…oren/cpython into macos11-deploy-earlier-branch
The tests are not entirely done yet, and something similar needs to be done for the time module.
…on isn't present. I don't particularly like the code duplication, but this code should be pretty stable.
|
I used the current state of the PR to build and test some installer variants. Due to time constraints and my currently degraded test environment, I focused first on regressions with currently supported systems. The configurations tested were:
I tested the installer 1 on 11.0 developer preview 9. The only unexpected failure was of the modified test_ctypes:
This also failed when running installer 2 on the same 11.0 system. I tested the installer 2 on 11.0 developer preview 9, 10.15, and 10.9. Other than the test_ctypes fallure mentioned above, there were no obvious regressions noted on 11.0, 10.15, or 10.9. I did not investigate in more detail whether the expected newer os.* functions and options were indeed available on 10.15 and not on 10.9, relying on the modified test suite to test that. At this point, I would be comfortable saying that merging the PR as it stands should not cause regressions when building Python from source on 10.9 through 10.15 and when building the current python.org 10.9 variant. It should also allow single architecture builds from source on 11.0, assuming the test_ctypes failure is resolved. More testing is required for universal2 builds and more work is required for installer builds on 11.0 and on 10.15. |
|
See comment in the discussion about current testing results. |
|
Great. The test failure with installer 1 on macOS 11 is expected due to the shared library cache. It is possible to ignore that failure by detecting that we're on 11.0 (or later) and |
|
FYI: My current plan is to merge next Saturday (Nov 7th), when I'll have time to react quickly to buildbot errors. |
|
FYI -- patchcheck is failing on this PR. |
|
I'm researching a crash that I get on a arm 11.0.1 rc1 when running test test suit (seems to be in the concurrent.future tests). |
I noticed this crash because I got popups from the system, even though test test suite itself does not report test failures. This was with an installed framework install, I don't get these pop ups with a unix install. These crashes are likely related to tests using the _crash function in test_concurrent_futures. This is not related to this PR and as such can be investigated more full later. |
4176193
into
python:master
|
Thanks @ronaldoussoren for the PR |
|
Sorry, @ronaldoussoren, I could not cleanly backport this to |
|
Thanks @ronaldoussoren for the PR |
|
Sorry @ronaldoussoren, I had trouble checking out the |
Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.
Backport of commit 4176193 to 3.9: ___ Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.
Backport of commit 4176193 to 3.9: ___ Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.
Backport of commit 4176193 to 3.9: ___ Co-authored-by: Lawrence D’Anna <lawrence_danna@apple.com> * Add support for macOS 11 and Apple Silicon (aka arm64) As a side effect of this work use the system copy of libffi on macOS, and remove the vendored copy * Support building on recent versions of macOS while deploying to older versions This allows building installers on macOS 11 while still supporting macOS 10.9.
(Apple Silicon being their aarch64 platform.) Patches consist of: - Upstream work: python/cpython#22855 - Fix for setup.py to find libbz2.tbd and libz.tbd now that with the shared library cache there's nothing in /usr/lib. See: https://bugs.python.org/issue41116 - Addition of __arch64__ case to fix _decimal module. A very similar fix has since been committed upstream.
|
Is the plan still to backport this (or a part of this) to Python 3.8? We are not yet planning to migrate to Python 3.9 and the ability to build for Apple Silicon being merged thus available downlevel would be helpful (I also wouldn't expect any guarantee of support, I'm thinking of this as a "you can build for this configuration but you're on your own" situation). |
|
@maxbelanger, sorry being out of the loop, though I hope this clarification may be useful to others who land on this ticket. |
|
@dimaqq sorry, that wasn't clear. I was referring to Dropbox; we ship Python as part of our client application on macOS. |
This merges my other two PRs, and improves on the PR that implements support for older macOS versions.
on systems that don't support his.
https://bugs.python.org/issue41100