Skip to content

gh-156115: Use the simulator deployment-target flag for iOS simulator builds - #156116

Open
clementperon wants to merge 2 commits into
python:mainfrom
clementperon:ios-simulator-version-min
Open

gh-156115: Use the simulator deployment-target flag for iOS simulator builds#156116
clementperon wants to merge 2 commits into
python:mainfrom
clementperon:ios-simulator-version-min

Conversation

@clementperon

@clementperon clementperon commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

configure appends -mios-version-min to CFLAGS/LDFLAGS for every iOS build. That is the device flag (an alias for -miphoneos-version-min), so against the simulator SDK the linker rejects everything it resolves there:

ld: building for 'iOS', but linking in dylib (.../iPhoneSimulator.sdk/usr/lib/libiconv.2.tbd) built for 'iOS-simulator'

_host_device is already derived from the host triple at configure.ac:794, so this selects the flag from it: -mios-simulator-version-min for the simulator, -mios-version-min unchanged for the device.

The wrappers in Platforms/Apple/iOS/Resources/bin hide this, because they pass --target=arm64-apple-ios-simulator and that pins the platform regardless of the later flag. Driving clang directly with -isysroot, as a cross-compiling build system typically does, hits it.

It is a quiet failure rather than a loud one. On unpatched main, a simulator configure still exits 0, but config.log holds 17 failed conftest links and features come out misdetected:

< /* #undef HAVE_ICONV */
< /* #undef HAVE_LIBSQLITE3 */
< /* #undef HAVE_ZLIB_COPY */
< /* #undef PY_SQLITE_HAVE_SERIALIZE */
---
> #define HAVE_ICONV 1
> #define HAVE_LIBSQLITE3 1
> #define HAVE_ZLIB_COPY 1
> #define PY_SQLITE_HAVE_SERIALIZE 1

With a library on LDFLAGS before the first compiler check it fails outright with configure: error: C compiler cannot create executables.

Verified on macOS/arm64: the simulator build emits -mios-simulator-version-min=12.0 and detects all four features; the device build still emits -mios-version-min=12.0 and is otherwise unchanged.

-mios-version-min names the device platform, so against the simulator SDK the
linker rejects every dylib it resolves there. Configuring for the simulator
still exits 0, but conftest links fail and iconv, sqlite3 and zlib features are
misdetected as absent; a build with a library on LDFLAGS before the first
compiler check fails outright instead.

The device/simulator split is already known from the host triple, so select the
flag from it.
clementperon added a commit to clementperon/xbmc that referenced this pull request Aug 20, 2026
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>
clementperon added a commit to clementperon/xbmc that referenced this pull request Aug 20, 2026
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>
clementperon added a commit to clementperon/xbmc that referenced this pull request Aug 20, 2026
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>

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mechanically correct, but I think it can be significantly simplified.

Comment thread configure.ac Outdated
Comment thread configure.ac Outdated
@bedevere-app

bedevere-app Bot commented Aug 21, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@clementperon

Copy link
Copy Markdown
Contributor Author

Thanks — both applied. The block is now a single AS_CASE on $host with an arm each for simulator and device, so it no longer depends on _host_device being set earlier, and the comment is gone.

Re-checked on macOS/arm64 with --enable-framework: --host=aarch64-apple-ios12.0-simulator emits -mios-simulator-version-min=12.0, --host=aarch64-apple-ios12.0 emits -mios-version-min=12.0, both configure cleanly.

I have made the requested changes; please review again

@bedevere-app

bedevere-app Bot commented Aug 21, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@freakboy3742: please review the changes made to this pull request.

@bedevere-app
bedevere-app Bot requested a review from freakboy3742 August 21, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants