| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
CPython appends -mios-version-min - the device flag - to every iOS build. Against the simulator SDK the linker rejects the dylibs it resolves there, and the first configure check that links one fails, taking the depends build with it. The local patch faked ac_sys_system=iOS by deleting CPython's host parsing, because config.site.in pinned every package to the tree's darwin triplet. Python now configures against its own iOS triplet, so CPython derives ac_sys_system, the deployment target and the device/simulator split itself, and the 76 lines that deleted that logic are gone. What is left matches three patches under review upstream, so all three can be dropped when python is next bumped: python/cpython#156110 python/cpython#156116 python/cpython#156113 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CPython appends -mios-version-min - the device flag - to every iOS build. Against the simulator SDK the linker rejects the dylibs it resolves there, and the first configure check that links one fails, taking the depends build with it. The local patch faked ac_sys_system=iOS by deleting CPython's host parsing, because config.site.in pinned every package to the tree's darwin triplet. Python now configures against its own iOS triplet, so CPython derives ac_sys_system, the deployment target and the device/simulator split itself, and the 76 lines that deleted that logic are gone. What is left matches three patches under review upstream, so all three can be dropped when python is next bumped: python/cpython#156110 python/cpython#156116 python/cpython#156113 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CPython appends -mios-version-min - the device flag - to every iOS build. Against the simulator SDK the linker rejects the dylibs it resolves there, and the first configure check that links one fails, taking the depends build with it. The local patch faked ac_sys_system=iOS by deleting CPython's host parsing, because config.site.in pinned every package to the tree's darwin triplet. Python now configures against its own iOS triplet, so CPython derives ac_sys_system, the deployment target and the device/simulator split itself, and the 76 lines that deleted that logic are gone. What is left matches three patches under review upstream, so all three can be dropped when python is next bumped: python/cpython#156110 python/cpython#156116 python/cpython#156113 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
From a pure configuration perspective, this seems a fairly straightforward. My concern is the impact on wheels (and, for that matter, the binaries in the standard library). iOS wheels are linked against libpython because -undefined is flagged as a deprecated linker argument. What (if any) testing have you done of this code with the standard library and/or third party libraries? |
Sorry, something went wrong.
|
Context first: Kodi embeds Python in a single signed app binary. It has built The stdlib is built static (MODULE_BUILDTYPE=static), so no wheels are Testing, honestly: I built libpython3.16.a for --host=aarch64-apple-ios12.0 --disable-shared --disable-framework and checked the configure matrix. No Your point about wheels stands: with no libpython dylib there is nothing for a
Happy to build the stdlib statically for iOS and report back if that helps. |
Sorry, something went wrong.
|
Ran the stdlib build — you were right, this is broken as it stands. make with --disable-shared --disable-framework fails on every shared extension module: ld: library 'System' not found make: *** [Modules/array.cpython-316.so] Error 1 configure.ac:3687 links iOS extensions against the framework unconditionally: iOS/*)
LDSHARED='$(CC) -dynamiclib -F . -framework $(PYTHONFRAMEWORK)'
PYTHONFRAMEWORK is empty without one, so -framework swallows the next argument. libpython3.16.a builds fine; only the shared modules fail. So a static libpython needs static modules — Kodi passes MODULE_BUILDTYPE=static, which is why it never hit this. The alternatives are -undefined dynamic_lookup (deprecated) or -bundle_loader on the final app executable, which the build can't know. I'll make configure require MODULE_BUILDTYPE=static for non-framework builds so this fails with a clear message instead, unless you'd rather it went differently. |
Sorry, something went wrong.
|
Follow-up: with MODULE_BUILDTYPE=static and --disable-test-modules, make completes — 46MB libpython3.16.a, 269 objects, stdlib extensions inside it, no .so produced. So my proposed requirement isn't sufficient alone: _testimportmultiple, xxlimited_35 and xxlimited_3_13 are shared by construction, so MODULE_BUILDTYPE doesn't reach them and they still fail on the empty -framework. Either require --disable-test-modules too, or mark shared-only modules unavailable when there's no framework (like PY_STDLIB_MOD_SET_NA) so the flags aren't needed. The latter looks better to me — your call, happy to do either. |
Sorry, something went wrong.
I feel like I'm having a conversation with an agent rather than a human, except without the ability to actually drive the conversation... What exactly are you proposing as the options here? |
Sorry, something went wrong.
|
@freakboy3742 yes, there is an AI agent in the loop. I use it to dig through the build system, and I read and approve everything before it gets posted. 3 propositions:
|
Sorry, something went wrong.
My inclination is to go with this - the fully explicit option. A static build is clearly useful, but there will be restrictions on use - I think there is value in requiring the prospective user to explicitly opt into all those options. These limitations will also need to be documented; a section on static builds (describing both the build process and limitations) to Platforms/Apple/iOS/README.md will be required. It may also be worth mentioning in Doc/using/iOS.rst that the official iOS release artefact is a framework build, but "static builds are also possible with limitations, see the README for details". |
Sorry, something went wrong.
Documentation build overview6 files changed · ± 6 modified ± Modified |
Sorry, something went wrong.
|
Done - pushed the explicit version. configure now refuses to proceed until you've asked for all of it: MODULE_BUILDTYPE=static, then --disable-test-modules, on top of --disable-framework --disable-shared. One error at a time, each naming the flag that's missing. Tested here on an arm64-apple-ios build: both errors fire in order, and with all four options the build completes - 46MB libpython3.16.a, stdlib extensions inside the archive, and no .so anywhere in the build tree. I also configured --enable-framework against main and diffed the results: Makefile, pyconfig.h and Setup.stdlib are identical, so framework builds are untouched. Two caveats: I didn't supply libffi/OpenSSL/XZ, so those modules are missing from that particular archive, and the test suite can't run in this configuration by construction. Docs as you asked: a "Building a static Python" section in Platforms/Apple/iOS/README.md covering the build process and the limitations (no binary wheels, stdlib extensions aren't loadable modules, no test suite, not covered by the Platforms/Apple script or CI), plus a note in Doc/using/ios.rst that the official release artefact is a framework build. |
Sorry, something went wrong.
A shared Python on iOS has to be packaged as a framework for App Store Connect to accept it. A static libpython is linked into the app binary and loads nothing at runtime, so the requirement does not apply to it, but configure refused that configuration outright. Refuse it only where it cannot work: a shared build with no framework. The LINKFORSHARED and MODULE_DEPS_SHARED framework references are gated on enable_framework, as the Darwin arm above already does, since a build without a framework has nothing to link against. A static build does come with restrictions - it cannot load extension modules at runtime, and so cannot use binary wheels - so require the user to opt into each of them explicitly. On top of --disable-framework and --disable-shared, configure now errors unless MODULE_BUILDTYPE=static is set (there is no framework for a shared extension module to link against) and --disable-test-modules is given (some test modules must be built as shared libraries; see Modules/Setup.stdlib.in). Passing no framework option at all still errors, so a non-framework build stays an explicit opt-in. Document the build process and its limitations in a new section of Platforms/Apple/iOS/README.md, and note in Doc/using/ios.rst that the official iOS release artefact is a framework build.
| Back | FazBrowse Home | New Git URL |
configure refuses any non-framework iOS build. That is correct for a shared Python — an iOS app can only load a signed framework, never a bare dylib — but a --disable-shared build produces a libpython3.x.a that is linked into the app binary and loads nothing at runtime, so the requirement does not apply to it.
This narrows the refusal to the combination that genuinely cannot work, and stops two Makefile variables referencing a framework that a non-framework build never produces.
Verified on macOS/arm64 against main:
configure was regenerated with Tools/build/regen-configure.sh; autoreconf -ivf -Werror is clean and the generated diff contains no unrelated churn.