Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-114099: Add configure and Makefile targets to support iOS compilation. #115390

Merged
merged 15 commits into from
Feb 26, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ Lib/test/data/*
/_bootstrap_python
/Makefile
/Makefile.pre
iOS/Resources/Info.plist
Mac/Makefile
Mac/PythonLauncher/Info.plist
Mac/PythonLauncher/Makefile
56 changes: 53 additions & 3 deletions Makefile.pre.in
Original file line number Diff line number Diff line change
@@ -911,6 +911,21 @@ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK): \
$(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)
$(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKDIR)/Resources

# This rule is for iOS, which requires an annoyingly just slighly different
# format for frameworks to macOS. It *doesn't* use a versioned framework, and
# the Info.plist must be in the root of the framework.
$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK): \
$(LIBRARY) \
$(RESSRCDIR)/Info.plist
$(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKDIR)
$(CC) -o $(LDLIBRARY) $(PY_CORE_LDFLAGS) -dynamiclib \
-all_load $(LIBRARY) \
-install_name $(PYTHONFRAMEWORKINSTALLNAMEPREFIX)/$(PYTHONFRAMEWORK) \
-compatibility_version $(VERSION) \
-current_version $(VERSION) \
-framework CoreFoundation $(LIBS);
$(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(PYTHONFRAMEWORKDIR)/Info.plist

# This rule builds the Cygwin Python DLL and import library if configured
# for a shared core library; otherwise, this rule is a noop.
$(DLLLIBRARY) libpython$(LDVERSION).dll.a: $(LIBRARY_OBJS)
@@ -2583,10 +2598,11 @@ frameworkinstall: install
# only have to cater for the structural bits of the framework.

.PHONY: frameworkinstallframework
frameworkinstallframework: frameworkinstallstructure install frameworkinstallmaclib
frameworkinstallframework: @FRAMEWORKINSTALLFIRST@ install frameworkinstallmaclib

.PHONY: frameworkinstallstructure
frameworkinstallstructure: $(LDLIBRARY)
# macOS uses a versioned frameworks structure that includes a full install
.PHONY: frameworkinstallversionedstructure
frameworkinstallversionedstructure: $(LDLIBRARY)
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
echo Not configured with --enable-framework; \
exit 1; \
@@ -2607,6 +2623,27 @@ frameworkinstallstructure: $(LDLIBRARY)
$(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources
$(INSTALL_SHARED) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)

# iOS/tvOS/watchOS uses a non-versioned framework with Info.plist in the
# framework root, no .lproj data, and only stub compilation assistance binaries
.PHONY: frameworkinstallunversionedstructure
frameworkinstallunversionedstructure: $(LDLIBRARY)
@if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \
echo Not configured with --enable-framework; \
exit 1; \
else true; \
fi
if test -d $(PYTHONFRAMEWORKPREFIX)/include; then \
echo "Clearing stale header symlink directory"; \
rm -rf $(PYTHONFRAMEWORKPREFIX)/include; \
fi
$(INSTALL) -d -m $(DIRMODE) $(PYTHONFRAMEWORKINSTALLDIR)
sed 's/%VERSION%/'"`$(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import platform; print(platform.python_version())'`"'/g' < $(RESSRCDIR)/Info.plist > $(PYTHONFRAMEWORKINSTALLDIR)/Info.plist
$(INSTALL_SHARED) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY)
$(INSTALL) -d -m $(DIRMODE) $(BINDIR)
for file in $(RESSRCDIR)/bin/* ; do \
Copy link
Member

Choose a reason for hiding this comment

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

When building outside of the source directory, the copy operation of the stub scripts to the bin directory fails because they are only in the source directory.

for file in $(srcdir)/$(RESSRCDIR)/bin/* ; do \

$(INSTALL) -m $(EXEMODE) $$file $(BINDIR); \
done

# This installs Mac/Lib into the framework
# Install a number of symlinks to keep software that expects a normal unix
# install (which includes python-config) happy.
@@ -2647,6 +2684,19 @@ frameworkaltinstallunixtools:
frameworkinstallextras:
cd Mac && $(MAKE) installextras DESTDIR="$(DESTDIR)"

# On iOS, bin/lib can't live inside the framework; include needs to be called
# "Headers", but *must* be in the framework, and *not* include the `python3.X`
# subdirectory. The install has put these folders in the same folder as
# Python.framework; Move the headers to their final framework-compatible home.
.PHONY: frameworkinstallmobileheaders
frameworkinstallmobileheaders:
if test -d $(PYTHONFRAMEWORKINSTALLDIR)/Headers; then \
echo "Removing old framework headers"; \
rm -rf $(PYTHONFRAMEWORKINSTALLDIR)/Headers; \
fi
mv "$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)" "$(PYTHONFRAMEWORKINSTALLDIR)/Headers"
$(LN) -fs "$(PYTHONFRAMEWORKDIR)" "$(PYTHONFRAMEWORKPREFIX)/include/python$(VERSION)"

# Build the toplevel Makefile
Makefile.pre: $(srcdir)/Makefile.pre.in config.status
CONFIG_FILES=Makefile.pre CONFIG_HEADERS= ./config.status
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Makefile targets were added to support compiling an iOS-compatible framework
build.
15 changes: 15 additions & 0 deletions Misc/platform_triplet.c
Original file line number Diff line number Diff line change
@@ -233,7 +233,22 @@ PLATFORM_TRIPLET=i386-gnu
# error unknown platform triplet
# endif
#elif defined(__APPLE__)
# include "TargetConditionals.h"
# if TARGET_OS_IOS
# if TARGET_OS_SIMULATOR
# if __x86_64__
PLATFORM_TRIPLET=x86_64-iphonesimulator
# else
PLATFORM_TRIPLET=arm64-iphonesimulator
# endif
# else
PLATFORM_TRIPLET=arm64-iphoneos
# endif
# elif TARGET_OS_OSX
PLATFORM_TRIPLET=darwin
# else
# error unknown Apple platform
# endif
#elif defined(__VXWORKS__)
PLATFORM_TRIPLET=vxworks
#elif defined(__wasm32__)
5 changes: 4 additions & 1 deletion config.sub
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

# shellcheck disable=SC2006,SC2268 # see below for rationale

# Patched 2024-02-03 to include support for arm64_32 and iOS/tvOS/watchOS simulators
timestamp='2024-01-01'

# This file is free software; you can redistribute it and/or modify it
@@ -1127,7 +1128,7 @@ case $cpu-$vendor in
xscale-* | xscalee[bl]-*)
cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
;;
arm64-* | aarch64le-*)
arm64-* | aarch64le-* | arm64_32-*)
cpu=aarch64
;;

@@ -1866,6 +1867,8 @@ case $kernel-$os-$obj in
;;
*-eabi*- | *-gnueabi*-)
;;
ios*-simulator- | tvos*-simulator- | watchos*-simulator- )
;;
none--*)
# None (no kernel, i.e. freestanding / bare metal),
# can be paired with an machine code file format
234 changes: 182 additions & 52 deletions configure

Large diffs are not rendered by default.

216 changes: 170 additions & 46 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -327,6 +327,9 @@ then
*-*-cygwin*)
ac_sys_system=Cygwin
;;
*-apple-ios*)
ac_sys_system=iOS
;;
*-*-vxworks*)
ac_sys_system=VxWorks
;;
@@ -484,10 +487,18 @@ AC_ARG_ENABLE([framework],
[
case $enableval in
yes)
if test "$ac_sys_system" = "iOS"; then
AC_MSG_ERROR([iOS builds must provide an explicit path for --enable-framework])
fi
enableval=/Library/Frameworks
esac
case $enableval in
no)
if test "$ac_sys_system" = "iOS"; then
AC_MSG_ERROR([iOS builds must use --enable-framework=<install path>])
fi
PYTHONFRAMEWORK=
PYTHONFRAMEWORKDIR=no-framework
PYTHONFRAMEWORKPREFIX=
@@ -511,11 +522,11 @@ AC_ARG_ENABLE([framework],
*)
PYTHONFRAMEWORKPREFIX="${enableval}"
PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR
FRAMEWORKINSTALLFIRST="frameworkinstallstructure"
FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure "
case $ac_sys_system in #(
Darwin) :
FRAMEWORKINSTALLFIRST="frameworkinstallversionedstructure"
FRAMEWORKALTINSTALLFIRST="frameworkinstallversionedstructure "
FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools"
FRAMEWORKALTINSTALLLAST="frameworkinstallmaclib frameworkinstallapps frameworkaltinstallunixtools"
FRAMEWORKPYTHONW="frameworkpythonw"
@@ -574,12 +585,30 @@ AC_ARG_ENABLE([framework],
AC_CONFIG_FILES([Mac/Resources/framework/Info.plist])
AC_CONFIG_FILES([Mac/Resources/app/Info.plist])
;;
iOS) :
FRAMEWORKINSTALLFIRST="frameworkinstallunversionedstructure"
FRAMEWORKALTINSTALLFIRST="frameworkinstallunversionedstructure "
FRAMEWORKINSTALLLAST="frameworkinstallmobileheaders"
FRAMEWORKALTINSTALLLAST="frameworkinstallmobileheaders"
FRAMEWORKPYTHONW=
INSTALLTARGETS="libinstall inclinstall sharedinstall"
prefix=$PYTHONFRAMEWORKPREFIX
PYTHONFRAMEWORKINSTALLNAMEPREFIX="@rpath/$PYTHONFRAMEWORKDIR"
RESSRCDIR=iOS/Resources
AC_CONFIG_FILES([iOS/Resources/Info.plist])
;;
*)
AC_MSG_ERROR([Unknown platform for framework build])
;;
esac
esac
],[
if test "$ac_sys_system" = "iOS"; then
AC_MSG_ERROR([iOS builds must use --enable-framework=<install path>])
fi
PYTHONFRAMEWORK=
PYTHONFRAMEWORKDIR=no-framework
PYTHONFRAMEWORKPREFIX=
@@ -634,6 +663,24 @@ if test "$cross_compiling" = yes; then
*-*-cygwin*)
_host_ident=
;;
*-apple-ios*)
_host_os=`echo $host | cut -d '-' -f3`
_host_device=`echo $host | cut -d '-' -f4`
_host_device=${_host_device:=os}

dnl IOS_DEPLOYMENT_TARGET is the minimum supported iOS version
IOS_DEPLOYMENT_TARGET=${_host_os:3}
IOS_DEPLOYMENT_TARGET=${IOS_DEPLOYMENT_TARGET:=12.0}

case "$host_cpu" in
aarch64)
_host_ident=${IOS_DEPLOYMENT_TARGET}-arm64-iphone${_host_device}
;;
*)
_host_ident=${IOS_DEPLOYMENT_TARGET}-$host_cpu-iphone${_host_device}
;;
esac
;;
*-*-vxworks*)
_host_ident=$host_cpu
;;
@@ -711,6 +758,9 @@ case $ac_sys_system/$ac_sys_release in
define_xopen_source=no;;
Darwin/@<:@[12]@:>@@<:@0-9@:>@.*)
define_xopen_source=no;;
# On iOS, defining _POSIX_C_SOURCE also disables platform specific features.
iOS/*)
define_xopen_source=no;;
# On QNX 6.3.2, defining _XOPEN_SOURCE prevents netdb.h from
# defining NI_NUMERICHOST.
QNX/6.3.2)
@@ -801,6 +851,15 @@ AS_CASE([$host],
],
)

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=${IOS_DEPLOYMENT_TARGET}"])
AS_VAR_APPEND([LDFLAGS], [" -mios-version-min=${IOS_DEPLOYMENT_TARGET}"])
AC_SUBST([IOS_DEPLOYMENT_TARGET])
],
)

if test "$ac_sys_system" = "Darwin"
then
dnl look for SDKROOT
@@ -967,6 +1026,7 @@ dnl platforms.
AC_MSG_CHECKING([for multiarch])
AS_CASE([$ac_sys_system],
[Darwin*], [MULTIARCH=""],
[iOS], [MULTIARCH=""],
[FreeBSD*], [MULTIARCH=""],
[MULTIARCH=$($CC --print-multiarch 2>/dev/null)]
)
@@ -988,6 +1048,7 @@ dnl will have multiple sysconfig modules (one for each CPU architecture), but
dnl use a single "fat" binary at runtime. SOABI_PLATFORM is the component of
dnl the PLATFORM_TRIPLET that will be used in binary module extensions.
AS_CASE([$ac_sys_system],
[iOS], [SOABI_PLATFORM=`echo "$PLATFORM_TRIPLET" | cut -d '-' -f2`],
[SOABI_PLATFORM=$PLATFORM_TRIPLET]
)

@@ -1019,6 +1080,8 @@ AS_CASE([$host/$ac_cv_cc_name],
[powerpc64le-*-linux-gnu/clang], [PY_SUPPORT_TIER=3], dnl Linux on PPC64 little endian, glibc, clang
[s390x-*-linux-gnu/gcc], [PY_SUPPORT_TIER=3], dnl Linux on 64bit s390x (big endian), glibc, gcc
[x86_64-*-freebsd*/clang], [PY_SUPPORT_TIER=3], dnl FreeBSD on AMD64
[aarch64-apple-ios*-simulator/clang], [PY_SUPPORT_TIER=3], dnl iOS Simulator on arm64
[aarch64-apple-ios*/clang], [PY_SUPPORT_TIER=3], dnl iOS on ARM64
[PY_SUPPORT_TIER=0]
)

@@ -1337,12 +1400,15 @@ AC_MSG_CHECKING([LDLIBRARY])
# will find it with a -framework option). For this reason there is an
# extra variable BLDLIBRARY against which Python and the extension
# modules are linked, BLDLIBRARY. This is normally the same as
# LDLIBRARY, but empty for MacOSX framework builds.
# LDLIBRARY, but empty for MacOSX framework builds. iOS does the same,
# but uses a non-versioned framework layout.
if test "$enable_framework"
then
case $ac_sys_system in
Darwin)
LDLIBRARY='$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)';;
iOS)
LDLIBRARY='$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)';;
*)
AC_MSG_ERROR([Unknown platform for framework build]);;
esac
@@ -1399,6 +1465,9 @@ if test $enable_shared = "yes"; then
BLDLIBRARY='-L. -lpython$(LDVERSION)'
RUNSHARED=DYLD_LIBRARY_PATH=`pwd`${DYLD_LIBRARY_PATH:+:${DYLD_LIBRARY_PATH}}
;;
iOS)
LDLIBRARY='libpython$(LDVERSION).dylib'
;;
AIX*)
LDLIBRARY='libpython$(LDVERSION).so'
RUNSHARED=LIBPATH=`pwd`${LIBPATH:+:${LIBPATH}}
@@ -3169,6 +3238,7 @@ if test -z "$SHLIB_SUFFIX"; then
esac
;;
CYGWIN*) SHLIB_SUFFIX=.dll;;
iOS) SHLIB_SUFFIX=.dylib;;
*) SHLIB_SUFFIX=.so;;
esac
fi
@@ -3249,6 +3319,11 @@ then
BLDSHARED="$LDSHARED"
fi
;;
iOS/*)
LDSHARED='$(CC) -dynamiclib -F . -framework Python'
LDCXXSHARED='$(CXX) -dynamiclib -F . -framework Python'
BLDSHARED="$LDSHARED"
;;
Emscripten|WASI)
LDSHARED='$(CC) -shared'
LDCXXSHARED='$(CXX) -shared';;
@@ -3369,30 +3444,34 @@ then
Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
# -u libsys_s pulls in all symbols in libsys
Darwin/*)
Darwin/*|iOS/*)
LINKFORSHARED="$extra_undefs -framework CoreFoundation"

# Issue #18075: the default maximum stack size (8MBytes) is too
# small for the default recursion limit. Increase the stack size
# to ensure that tests don't crash
stack_size="1000000" # 16 MB
if test "$with_ubsan" = "yes"
then
# Undefined behavior sanitizer requires an even deeper stack
stack_size="4000000" # 64 MB
fi
stack_size="1000000" # 16 MB
if test "$with_ubsan" = "yes"
then
# Undefined behavior sanitizer requires an even deeper stack
stack_size="4000000" # 64 MB
fi

LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED"
AC_DEFINE_UNQUOTED([THREAD_STACK_SIZE],
[0x$stack_size],
[Custom thread stack size depending on chosen sanitizer runtimes.])

AC_DEFINE_UNQUOTED([THREAD_STACK_SIZE],
[0x$stack_size],
[Custom thread stack size depending on chosen sanitizer runtimes.])
if test $ac_sys_system = "Darwin"; then
LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED"

if test "$enable_framework"
then
LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
if test "$enable_framework"; then
LINKFORSHARED="$LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
fi
LINKFORSHARED="$LINKFORSHARED"
elif test $ac_sys_system = "iOS"; then
LINKFORSHARED="-Wl,-stack_size,$stack_size $LINKFORSHARED "'$(PYTHONFRAMEWORKDIR)/$(PYTHONFRAMEWORK)'
fi
LINKFORSHARED="$LINKFORSHARED";;
;;
OpenUNIX*|UnixWare*) LINKFORSHARED="-Wl,-Bexport";;
SCO_SV*) LINKFORSHARED="-Wl,-Bexport";;
ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
@@ -3766,6 +3845,9 @@ AS_VAR_IF([have_libffi], [yes], [
dnl when do we need USING_APPLE_OS_LIBFFI?
ctypes_malloc_closure=yes
],
[iOS], [
ctypes_malloc_closure=yes
],
[sunos5], [AS_VAR_APPEND([LIBFFI_LIBS], [" -mimpure-text"])]
)
AS_VAR_IF([ctypes_malloc_closure], [yes], [
@@ -4831,8 +4913,8 @@ AC_CHECK_FUNCS([ \
copy_file_range ctermid dup dup3 execv explicit_bzero explicit_memset \
faccessat fchmod fchmodat fchown fchownat fdopendir fdwalk fexecve \
fork fork1 fpathconf fstatat ftime ftruncate futimens futimes futimesat \
gai_strerror getegid getentropy geteuid getgid getgrent getgrgid getgrgid_r \
getgrnam_r getgrouplist getgroups gethostname getitimer getloadavg getlogin \
gai_strerror getegid geteuid getgid getgrent getgrgid getgrgid_r \
getgrnam_r getgrouplist gethostname getitimer getloadavg getlogin \
getpeername getpgid getpid getppid getpriority _getpty \
getpwent getpwnam_r getpwuid getpwuid_r getresgid getresuid getrusage getsid getspent \
getspnam getuid getwd grantpt if_nameindex initgroups kill killpg lchown linkat \
@@ -4849,7 +4931,7 @@ AC_CHECK_FUNCS([ \
setresuid setreuid setsid setuid setvbuf shutdown sigaction sigaltstack \
sigfillset siginterrupt sigpending sigrelse sigtimedwait sigwait \
sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
sysconf system tcgetpgrp tcsetpgrp tempnam timegm times tmpfile \
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile \
tmpnam tmpnam_r truncate ttyname umask uname unlinkat unlockpt utimensat utimes vfork \
wait wait3 wait4 waitid waitpid wcscoll wcsftime wcsxfrm wmemcmp writev \
])
@@ -4861,6 +4943,14 @@ if test "$MACHDEP" != linux; then
AC_CHECK_FUNCS([lchmod])
fi

# iOS defines some system methods that can be linked (so they are
# found by configure), but either raise a compilation error (because the
# header definition prevents usage - autoconf doesn't use the headers), or
# raise an error if used at runtime. Force these symbols off.
if test "$ac_sys_system" != "iOS" ; then
AC_CHECK_FUNCS([getentropy getgroups system])
fi

AC_CHECK_DECL([dirfd],
[AC_DEFINE([HAVE_DIRFD], [1],
[Define if you have the 'dirfd' function or macro.])],
@@ -5161,11 +5251,16 @@ AC_CHECK_FUNCS([clock_getres], [], [
])
])

AC_CHECK_FUNCS([clock_settime], [], [
AC_CHECK_LIB([rt], [clock_settime], [
AC_DEFINE([HAVE_CLOCK_SETTIME], [1])
])
])
# On iOS, clock_settime can be linked (so it is found by
# configure), but it raises a runtime error if used because apps can't change
# the clock. Force the symbol off.
if test "$ac_sys_system" != "iOS" ; then
AC_CHECK_FUNCS([clock_settime], [], [
AC_CHECK_LIB([rt], [clock_settime], [
AC_DEFINE([HAVE_CLOCK_SETTIME], [1])
])
])
fi

AC_CHECK_FUNCS([clock_nanosleep], [], [
AC_CHECK_LIB([rt], [clock_nanosleep], [
@@ -6524,28 +6619,35 @@ CPPFLAGS=$ac_save_cppflags
AC_MSG_NOTICE([checking for device files])

dnl NOTE: Inform user how to proceed with files when cross compiling.
if test "x$cross_compiling" = xyes; then
if test "${ac_cv_file__dev_ptmx+set}" != set; then
AC_MSG_CHECKING([for /dev/ptmx])
AC_MSG_RESULT([not set])
AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
fi
if test "${ac_cv_file__dev_ptc+set}" != set; then
AC_MSG_CHECKING([for /dev/ptc])
AC_MSG_RESULT([not set])
AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
dnl iOS cross-compile builds are predictable; they won't ever
dnl have /dev/ptmx or /dev/ptc, so we can set them explicitly.
if test "$ac_sys_system" = "iOS" ; then
ac_cv_file__dev_ptmx=no
ac_cv_file__dev_ptc=no
else
if test "x$cross_compiling" = xyes; then
if test "${ac_cv_file__dev_ptmx+set}" != set; then
AC_MSG_CHECKING([for /dev/ptmx])
AC_MSG_RESULT([not set])
AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
fi
if test "${ac_cv_file__dev_ptc+set}" != set; then
AC_MSG_CHECKING([for /dev/ptc])
AC_MSG_RESULT([not set])
AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
fi
fi
fi

AC_CHECK_FILE([/dev/ptmx], [], [])
if test "x$ac_cv_file__dev_ptmx" = xyes; then
AC_DEFINE([HAVE_DEV_PTMX], [1],
[Define to 1 if you have the /dev/ptmx device file.])
fi
AC_CHECK_FILE([/dev/ptc], [], [])
if test "x$ac_cv_file__dev_ptc" = xyes; then
AC_DEFINE([HAVE_DEV_PTC], [1],
[Define to 1 if you have the /dev/ptc device file.])
AC_CHECK_FILE([/dev/ptmx], [], [])
if test "x$ac_cv_file__dev_ptmx" = xyes; then
AC_DEFINE([HAVE_DEV_PTMX], [1],
[Define to 1 if you have the /dev/ptmx device file.])
fi
AC_CHECK_FILE([/dev/ptc], [], [])
if test "x$ac_cv_file__dev_ptc" = xyes; then
AC_DEFINE([HAVE_DEV_PTC], [1],
[Define to 1 if you have the /dev/ptc device file.])
fi
fi

if test $ac_sys_system = Darwin
@@ -7188,6 +7290,28 @@ AS_CASE([$ac_sys_system],
[VxWorks*], [PY_STDLIB_MOD_SET_NA([_scproxy], [termios], [grp])],
dnl The _scproxy module is available on macOS
[Darwin], [],
[iOS], [
dnl subprocess and multiprocessing are not supported (no fork syscall).
dnl curses and tkinter user interface are not available.
dnl gdbm and nis aren't available
dnl Stub implementations are provided for pwd, grp etc APIs
PY_STDLIB_MOD_SET_NA(
[_curses],
[_curses_panel],
[_gdbm],
[_multiprocessing],
[_posixshmem],
[_posixsubprocess],
[_scproxy],
[_tkinter],
[grp],
[nis],
[readline],
[pwd],
[spwd],
[syslog],
)
],
[CYGWIN*], [PY_STDLIB_MOD_SET_NA([_scproxy])],
[QNX*], [PY_STDLIB_MOD_SET_NA([_scproxy])],
[FreeBSD*], [PY_STDLIB_MOD_SET_NA([_scproxy])],
294 changes: 294 additions & 0 deletions iOS/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
====================
Python on iOS README
====================

:Authors:
Russell Keith-Magee (2023-11)

This document provides a quick overview of some iOS specific features in the
Python distribution.

These instructions are only needed if you're planning to compile Python for iOS
yourself. Most users should *not* need to do this. If you're looking to
experiment with writing an iOS app in Python on iOS, tools such as `BeeWare's
Briefcase <https://briefcase.readthedocs.io>`__ and `Kivy's Builddozer
<https://buildozer.readthedocs.io>`__ will provide a much more approachable user
experience.

Compilers for building on iOS
=============================

Building for iOS requires the use of Apple's Xcode tooling. It is strongly
recommended that you use the most recent stable release of Xcode. This will
require the use of the most (or second-most) recently released macOS version,
as Apple does not maintain Xcode for older macOS versions.

iOS specific arguments to configure
===================================

* ``--enable-framework=DIR``

This argument specifies the location where the Python.framework will be
installed. This argument is required for all iOS builds; a directory *must*
be specified.

* ``--with-framework-name=NAME``

Specify the name for the python framework; defaults to ``Python``.

Building Python on iOS
======================

ABIs and Architectures
----------------------

iOS apps can be deployed on physical devices, and on the iOS simulator. Although
the API used on these devices is identical, the ABI is different - you need to
link against different libraries for an iOS device build (``iphoneos``) or an
iOS simulator build (``iphonesimulator``).

Apple uses the ``XCframework`` format to allow specifying a single dependency
that supports multiple ABIs. An ``XCframework`` is a wrapper around multiple
ABI-specific frameworks that share a common API.

iOS can also support different CPU architectures within each ABI. At present,
there is only a single supported architecture on physical devices - ARM64.
However, the *simulator* supports 2 architectures - ARM64 (for running on Apple
Silicon machines), and x86_64 (for running on older Intel-based machines).

To support multiple CPU architectures on a single platform, Apple uses a "fat
binary" format - a single physical file that contains support for multiple
architectures. It is possible to compile and use a "thin" single architecture
version of a binary for testing purposes; however, the "thin" binary will not be
portable to machines using other architectures.

Building a single-architecture framework
----------------------------------------

The Python build system will create a ``Python.framework`` that supports a
*single* ABI with a *single* architecture. Unlike macOS, iOS does not allow a
framework to contain non-library content, so the iOS build will produce a
``bin`` and ``lib`` folder in the same output folder as ``Python.framework``.
The ``lib`` folder will be needed at runtime to support the Python library.

If you want to use Python in a real iOS project, you need to produce multiple
``Python.framework`` builds, one for each ABI and architecture. iOS builds of
Python *must* be constructed as framework builds. To support this, you must
provide the ``--enable-framework`` flag when configuring the build. The build
also requires the use of cross-compilation. The minimal commands for building
Python for the ARM64 iOS simulator will look something like::

$ export PATH="`pwd`/iOS/Resources/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin"
$ ./configure \
AR=arm64-apple-ios-simulator-ar \
CC=arm64-apple-ios-simulator-clang \
CPP=arm64-apple-ios-simulator-cpp \
CXX=arm64-apple-ios-simulator-clang \
--enable-framework=/path/to/install \
--host=aarch64-apple-ios-simulator \
--build=aarch64-apple-darwin \
--with-build-python=/path/to/python.exe
$ make
$ make install

In this invocation:

* ``iOS/Resources/bin`` has been added to the path, providing some shims for the
compilers and linkers needed by the build. Xcode requires the use of ``xcrun``
to invoke compiler tooling; however, ``xcrun`` embeds user- and
version-specific paths into the sysconfig data, which limits the portability
of the compiled Python. It also requires that compiler variables like ``CC``
include spaces, which can cause significant problems with many C configuration
systems which assume that ``CC`` will be a single executable. The
``iOS/Resources/bin`` folder contains some wrapper scripts that present as
simple compilers and linkers, but wrap underlying calls to ``xcrun``.

The path has also been cleared of any user customizations. A common source of
bugs is for tools like Homebrew to accidentally leak macOS binaries into an iOS
build. Resetting the path to a known "bare bones" value is the easiest way to
avoid these problems.

* ``/path/to/install`` is the location where the final ``Python.framework`` will
be output.

* ``--host`` is the architecture and ABI that you want to build, in GNU compiler
triple format. This will be one of:

- ``aarch64-apple-ios`` for ARM64 iOS devices.
- ``aarch64-apple-ios-simulator`` for the iOS simulator running on Apple
Silicon devices.
- ``x86_64-apple-ios-simulator`` for the iOS simulator running on Intel
devices.

* ``--build`` is the GNU compiler triple for the machine that will be running
the compiler. This is one of:

- ``aarch64-apple-darwin`` for Apple Silicon devices.
- ``x86_64-apple-darwin`` for Intel devices.

* ``/path/to/python.exe`` is the path to a Python binary on the machine that
will be running the compiler. This is needed because the Python compilation
process involves running some Python code. On a normal desktop build of
Python, you can compile a python interpreter and then use that interpreter to
run Python code. However, the binaries produced for iOS won't run on macOS, so
you need to provide an external Python interpreter. This interpreter must be
the *exact* same version as the Python that is being compiled.
Copy link
Member

Choose a reason for hiding this comment

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

One further thought here: perhaps we should be a bit more exact about what is meant by the *exact* same version. A builder could rightfully question whether that means that the build Python has to be built from the exact same source checkout as the iOS version(s) being cross-built. Or is a build Python from the same branch OK, e.g. a Python 3.13.x? This is more of an issue once 3.13, say, is released and we promise things like ABI compatibility, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once a release is finalised, it's generally safe to use any 3.X build as a host Python for a cross platform build of 3.X.Y. However, there were at least 2 commits in January (both threading related) that caused an issue with iOS cross-platform builds of 3.13 if the host Python wasn't the same commit hash. That's easy enough to put down to "main branch is a moving target"; but I believe this could manifest with 3.X.Y as a host for 3.X.Y+1 because there's no guarantee that the bytecode magic number will remain consistent in a 3.X series.

So - the safest answer here is "the same commit hash"; but there's often a bit of leeway. I'll clarify the language here to a "hope for the best, expect the worst" kind of framing.


For a full CPython build, you also need to specify the paths to iOS builds of
the binary libraries that CPython depends on (XZ, BZip2, LibFFI and OpenSSL).
This can be done by defining the ``LIBLZMA_CFLAGS``, ``LIBLZMA_LIBS``,
``BZIP2_CFLAGS``, ``BZIP2_LIBS``, ``LIBFFI_CFLAGS``, and ``LIBFFI_LIBS``
environment variables, and the ``--with-openssl`` configure option. Versions of
these libraries pre-compiled for iOS can be found in [this
repository](https://github.com/beeware/cpython-apple-source-deps/releases).

By default, Python will be compiled with an iOS deployment target (i.e., the
minimum supported iOS version) of 12.0. To specify a different deployment
target, provide the version number as part of the ``--host`` argument - for
example, ``--host=arm64-apple-ios15.4-simulator`` would compile an ARM64
simulator build with a deployment target of 15.4.

Merge thin frameworks into fat frameworks
-----------------------------------------

Once you've built a ``Python.framework`` for each ABI and and architecture, you
must produce a "fat" framework for each ABI that contains all the architectures
for that ABI.

The ``iphoneos`` build only needs to support a single architecture, so it can be
used without modification.

If you only want to support a single simulator architecture, (e.g., only support
ARM64 simulators), you can use a single architecture ``Python.framework`` build.
However, if you want to create ``Python.xcframework`` that supports *all*
architectures, you'll need to merge the ``iphonesimulator`` builds for ARM64 and
x86_64 into a single "fat" framework.

The "fat" framework can be constructed by performing a directory merge of the
content of the two "thin" ``Python.framework`` directories, plus the ``bin`` and
``lib`` folders for each thin framework. When performing this merge:

* The pure Python standard library content is identical for each architecture,
except for a handful of platform-specific files (such as the ``sysconfig``
module). Ensure that the "fat" framework has the union of all standard library
files.

* Any binary files in the standard library, plus the main
``libPython3.X.dylib``, can be merged using the ``lipo`` tool, provide by
Xcode::

$ lipo -create -output module.dylib path/to/x86_64/module.dylib path/to/arm64/module.dylib

* The header files will be indentical on both architectures, except for
``pyconfig.h``. Copy all the headers from one platform (say, arm64), rename
``pyconfig.h`` to ``pyconfig-arm64.h``, and copy the ``pyconfig.h`` for the
other architecture into the merged header folder as ``pyconfig-x86_64.h``.
Then copy the ``iOS/Resources/pyconfig.h`` file from the CPython sources into
the merged headers folder. This will allow the two Python architectures to
share a common ``pyconfig.h`` header file.

At this point, you should have 2 Python.framework folders - one for ``iphoneos``,
and one for ``iphonesimulator`` that is a merge of x86+64 and ARM64 content.

Merge frameworks into an XCframework
------------------------------------

Now that we have 2 (potentially fat) ABI-specific frameworks, we can merge those
frameworks into a single ``XCframework``.

The initial skeleton of an ``XCframework`` is built using::

xcodebuild -create-xcframework -output Python.xcframework -framework path/to/iphoneos/Python.framework -framework path/to/iphonesimulator/Python.framework

Then, copy the ``bin`` and ``lib`` folders into the architecture-specific slices of
the XCframework::

cp path/to/iphoneos/bin Python.xcframework/ios-arm64
cp path/to/iphoneos/lib Python.xcframework/ios-arm64

cp path/to/iphonesimulator/bin Python.xcframework/ios-arm64_x86-64-simulator
cp path/to/iphonesimulator/lib Python.xcframework/ios-arm64_x86-64-simulator

Note that the name of the architecture-specific slice for the simulator will
depend on the CPU architecture that you build.

Then, add symbolic links to "common" platform names for each slice::

ln -si ios-arm64 Python.xcframework/iphoneos
ln -si ios-arm64_x86-64-simulator Python.xcframework/iphonesimulator

You now have a Python.xcframework that can be used in a project.

Testing Python on iOS
=====================

The ``Tools/iOSTestbed`` folder that contains an Xcode project that is able to run
the iOS test suite. This project converts the Python test suite into a single
test case in Xcode's XCTest framework. The single XCTest passes if the test
suite passes.

To run the test suite, configure a Python build for an iOS simulator (i.e.,
``--host=aarch64-apple-ios-simulator`` or ``--host=x86_64-apple-ios-simulator``
), setting the framework location to the testbed project::

--enable-framework="./Tools/iOSTestbed/Python.xcframework/ios-arm64_x86_64-simulator"

Then run ``make all install testiOS``. This will build an iOS framework for your
chosen architecture, install the Python iOS framework into the testbed project,
and run the test suite on an "iPhone SE (3rd generation)" simulator.

While the test suite is running, Xcode does not display any console output.
After showing some Xcode build commands, the console output will print ``Testing
started``, and then appear to stop. It will remain in this state until the test
suite completes. On a 2022 M1 MacBook Pro, the test suite takes approximately 12
minutes to run; a couple of extra minutes is required to boot and prepare the
iOS simulator.

On success, the test suite will exit and report successful completion of the
test suite. No output of the Python test suite will be displayed.

On failure, the output of the Python test suite *will* be displayed. This will
show the details of the tests that failed.

Debugging test failures
-----------------------

The easiest way to diagnose a single test failure is to open the testbed project
in Xcode and run the tests from there using the "Product > Test" menu item.

Running specific tests
^^^^^^^^^^^^^^^^^^^^^^

As the test suite is being executed on an iOS simulator, it is not possible to
pass in command line arguments to configure test suite operation. To work around
this limitation, the arguments that would normally be passed as command line
arguments are configured as a static string at the start of the XCTest method
``- (void)testPython`` in ``iOSTestbedTests.m``. To pass an argument to the test
suite, add a a string to the ``argv`` defintion. These arguments will be passed
to the test suite as if they had been passed to ``python -m test`` at the
command line.

Disabling automated breakpoints
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

By default, Xcode will inserts an automatic breakpoint whenever a signal is
raised. The Python test suite raises many of these signals as part of normal
operation; unless you are trying to diagnose an issue with signals, the
automatic breakpoints can be inconvenient. However, they can be disabled by
creating a symbolic breakpoint that is triggered at the start of the test run.

Select "Debug > Breakpoints > Create Symbolic Breakpoint" from the Xcode menu, and
populate the new brewpoint with the following details:

* **Name**: IgnoreSignals
* **Symbol**: UIApplicationMain
* **Action**: Add debugger commands for:
- ``process handle SIGINT -n true -p true -s false``
- ``process handle SIGUSR1 -n true -p true -s false``
- ``process handle SIGUSR2 -n true -p true -s false``
- ``process handle SIGXFSZ -n true -p true -s false``
* Check the "Automatically continue after evaluating" box.

All other details can be left blank. When the process executes the
``UIApplicationMain`` entry point, the breakpoint will trigger, run the debugger
commands to disable the automatic breakpoints, and automatically resume.
34 changes: 34 additions & 0 deletions iOS/Resources/Info.plist.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>Python</string>
<key>CFBundleGetInfoString</key>
<string>Python Runtime and Library</string>
<key>CFBundleIdentifier</key>
<string>@PYTHONFRAMEWORKIDENTIFIER@</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Python</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>%VERSION%</string>
<key>CFBundleLongVersionString</key>
<string>%VERSION%, (c) 2001-2024 Python Software Foundation.</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>MinimumOSVersion</key>
<string>@IOS_DEPLOYMENT_TARGET@</string>
</dict>
</plist>
2 changes: 2 additions & 0 deletions iOS/Resources/bin/arm64-apple-ios-ar
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
xcrun --sdk iphoneos ar $@
Copy link
Member

@ned-deily ned-deily Feb 22, 2024

Choose a reason for hiding this comment

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

The use of these stub scripts for executables is a clever solution. As they stand, I think there is one potential shortcoming if I understand the xcrun documentation correctly (I haven't yet verified this): according to the man page, specifying --sdk to xcrun overrides any SDKROOT environment variable, something which I've had occasion to use when building and testing for multiple macOS versions. It's probably less of a deal on iOS but I think it would be nice to allow for this. If the behavior is as documented, perhaps the stub scripts could do a test for the presence of an SDKROOT env variable and, if defined, not specify --sdk iphoneos?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's an easy enough change to make; however, it does open a potential class of bugs.

As currently defined, arm64-apple-ios-clang will always be a clang install for ARM64 iOS devices. If we allow for SDKROOT as you describe, a user could easily think they're compiling an iOS build, but actually be using an iOS simulator SDK (or worse - a macOS or watchOS SDK).

This is especially problematic when the values are embedded in sysconfig, as the CC value embedded in sysconfig will become dependent on the end-user's environment.

You can still switch between different Xcode installs with xcode-select for testing purposes; I'd argue this is likely more useful for testing purposes, as Xcode leans heavily to having a single iOS SDK per Xcode install.

My inclination is that being explicit with --sdk in these scripts and overriding SDKROOT is preferable on balance, but I'll defer to your judgement if you feel strongly otherwise. If we do make this change, I'll add some docs clarifying how SDKROOT is interpreted, and clarifying that it's the user's responsibility to make sure SDKROOT matches their intended compilation target.

Copy link
Member

Choose a reason for hiding this comment

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

I see two drawbacks with relying solely on xcode-select. One, xcode-select -s has effect system-wide, and so would affect all other uses and users of Xcode on that system. Of course, there is another way to effect this on a process basis: set a DEVELOPER_DIR env variable. But, two, even with that, AFAICT there still would be no way to select a non-default iOS SDK within a particular Xcode instance and, while it may not be the default case at the moment, it would be better to not preclude supporting more than one SDK available in an Xcode instance. I think the primary value of supporting all this would be during development and testing of Python iOS frameworks themselves and, as such, you likely wouldn't want to use them in an actual release of a Python iOS framework but there might be cases where you would. (And, the end-user of the framework, presumably someone developing an iOS app, would need to ensure they had a compatible developer environment anyway.)

So perhaps a slightly simpler way to address these concerns would be to define a new env variable that would allow overriding the SDK name in the stubs, something like IOSSDK='iphoneos17.1' (I'm not hung up on the name) instead of the default iphoneos ?, and mentioning setting DEVELOPER_DIR to use a non-default Xcode installation:

xcrun --sdk ${IOSSDK:-iphoneos} clang -target arm64-apple-ios $@

Or we could just defer this until a demonstrated need arises but I think it is worth considering.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passing in a specific SDK (or even better, a specific SDK version) with a custom environment variable makes sense to me. I'll push an update shortly that uses IOS_SDK_VERSION so you can get iphoneosX.Y and iphonesimulatorX.Y from a single environment variable (since the base names of the SDKs are stable, and I can't think of a use case where you'd want a different version for the device vs simulator SDK in a single build), along with docs covering the new variable and DEVELOPER_DIR

2 changes: 2 additions & 0 deletions iOS/Resources/bin/arm64-apple-ios-clang
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I didn't notice these earlier: all of the stubs should just use a shebang line of /bin/sh rather than bash since bash is officially deprecated on macOS, and there are no bash-isms used.

xcrun --sdk iphoneos clang -target arm64-apple-ios $@
2 changes: 2 additions & 0 deletions iOS/Resources/bin/arm64-apple-ios-cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
xcrun --sdk iphoneos clang -target arm64-apple-ios -E $@
2 changes: 2 additions & 0 deletions iOS/Resources/bin/arm64-apple-ios-simulator-ar
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
xcrun --sdk iphonesimulator ar $@
2 changes: 2 additions & 0 deletions iOS/Resources/bin/arm64-apple-ios-simulator-clang
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
xcrun --sdk iphonesimulator clang -target arm64-apple-ios-simulator $@
2 changes: 2 additions & 0 deletions iOS/Resources/bin/arm64-apple-ios-simulator-cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
xcrun --sdk iphonesimulator clang -target arm64-apple-ios-simulator -E $@
2 changes: 2 additions & 0 deletions iOS/Resources/bin/x86_64-apple-ios-simulator-ar
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
xcrun --sdk iphonesimulator ar $@
2 changes: 2 additions & 0 deletions iOS/Resources/bin/x86_64-apple-ios-simulator-clang
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
xcrun --sdk iphonesimulator clang -target x86_64-apple-ios-simulator $@
2 changes: 2 additions & 0 deletions iOS/Resources/bin/x86_64-apple-ios-simulator-cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
xcrun --sdk iphonesimulator clang -target x86_64-apple-ios-simulator -E $@
26 changes: 26 additions & 0 deletions iOS/Resources/dylib-Info-template.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string></string>
<key>CFBundleIdentifier</key>
<string></string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>MinimumOSVersion</key>
<string>12.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
7 changes: 7 additions & 0 deletions iOS/Resources/pyconfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifdef __arm64__
#include "pyconfig-arm64.h"
#endif

#ifdef __x86_64__
#include "pyconfig-x86_64.h"
#endif

Unchanged files with check annotations Beta

in the runtime init code (in pystate.c and pylifecycle.c). */
#define _PyRuntimeState_INIT(runtime) \
{ \

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.2.1)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.1.5)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (1.1.1w)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu SSL tests with OpenSSL (3.0.13)

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Hypothesis tests on Ubuntu

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Ubuntu / build and test

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]

Check warning on line 32 in Include/internal/pycore_runtime_init.h

GitHub Actions / Address sanitizer

missing braces around initializer [-Wmissing-braces]
.debug_offsets = { \
.cookie = "xdebugpy", \
.version = PY_VERSION_HEX, \