Repository navigation
iOS simulator builds get the device -mios-version-min flag, breaking library detection #156115
Description
Bug report
Bug description:
configure appends the device deployment-target flag to every iOS build, simulator included:
dnl Add the compiler flag for the iOS minimum supported OS version.
AS_CASE([$ac_sys_system],
[iOS], [
AS_VAR_APPEND([CFLAGS], [" -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET}"])
AS_VAR_APPEND([LDFLAGS], [" -mios-version-min=${IPHONEOS_DEPLOYMENT_TARGET}"])
],
)-mios-version-min is an alias for -miphoneos-version-min, so it sets the platform to iOS device. Against the simulator SDK the linker then refuses everything it resolves there:
ld: building for 'iOS', but linking in dylib (.../iPhoneSimulator.sdk/usr/lib/libiconv.2.tbd) built for 'iOS-simulator'
configure already knows which one it is — _host_device is derived from the host triple at configure.ac:794 and is simulator here — but the flag ignores it.
This is masked when the compiler is invoked through the wrappers in Platforms/Apple/iOS/Resources/bin, because those pass --target=arm64-apple-ios-simulator, which pins the platform and makes the later flag inert. It bites anyone driving clang directly with -isysroot, which is the usual arrangement for a cross-compiling build system.
The failure is quiet rather than loud. Configuring main for the simulator this way still exits 0, but 17 conftest links fail in config.log and features are misdetected:
$ diff <(unpatched pyconfig.h) <(patched pyconfig.h)
< /* #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 1If any library ends up on LDFLAGS before the first compiler check, it fails outright instead, with configure: error: C compiler cannot create executables.
Reproducer, on macOS with Xcode:
SDK=$(xcrun --sdk iphonesimulator --show-sdk-path)
CC="$(xcrun --sdk iphonesimulator -f clang)" \
CPP="$CC -E" CFLAGS="-isysroot $SDK -arch arm64" LDFLAGS="-isysroot $SDK -arch arm64" \
../configure --host=aarch64-apple-ios12.0-simulator --build=$(../config.guess) \
--enable-framework --with-build-python=...
grep "^ld: building for" config.logSelecting -mios-simulator-version-min when _host_device is simulator fixes it; the device build is unchanged. PR to follow.
CPython versions tested on:
CPython main
Operating systems tested on:
macOS
Linked PRs
- gh-156115: Use the simulator deployment-target flag for iOS simulator builds #156116
- [3.15] gh-156115: Use the simulator deployment-target flag for iOS simulator builds (GH-156116) #156211
- [3.14] gh-156115: Use the simulator deployment-target flag for iOS simulator builds (GH-156116) #156212
- [3.13] gh-156115: Use the simulator deployment-target flag for iOS simulator builds (GH-156116) #156213
Activity
freakboy3742 commentedon Aug 21, 2026
As with the other issues you've raised today, your analysis sounds plausible enough... but what is the reproduction case? There's a reference to "driving clang directly", and you've provided a command line that looks like it is compiling something directly - but you haven't provided details that would allow someone to actually reproduce the problem you're seeing. I can't emphasise enough the importance of providing bug reports that allow someone else to reproduce your work with the least possible effort.
gh-156115: Use the simulator deployment-target flag for iOS simulator…
[3.13] gh-156115: Use the simulator deployment-target flag for iOS si…
[3.14] gh-156115: Use the simulator deployment-target flag for iOS si…
[3.15] gh-156115: Use the simulator deployment-target flag for iOS si…
[3.13] pythongh-156115: Use the simulator deployment-target flag for …
[3.12] pythongh-156115: Use the simulator deployment-target flag for …
[3.11] pythongh-156115: Use the simulator deployment-target flag for …
[3.14] pythongh-156115: Use the simulator deployment-target flag for …
[3.12] pythongh-156115: Use the simulator deployment-target flag for …