GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-114099: Add preprocessor declarations to support compilation on iOS by freakboy3742 · Pull Request #115023 · python/cpython

Conversation

@freakboy3742

@freakboy3742 freakboy3742 commented Feb 5, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Part of the PEP 730 work to add iOS support.

Adds preprocessor declarations to C code to support compilation of the standard library on iOS/tvOS/watchOS.

These changes involve:

  • Explicitly disabling methods that are detected by configure, but raise a compilation or runtime error if actually used.
  • Allowing for the required .dylib extension on iOS dynamic libraries
  • Setting the marshalling stack depth
  • Providing a simulated response for the "user" on an iOS simulator
  • Providing a PLATFORM_TRIPLET based on compiler behavior

The preprocessor symbols used to identify Apple platforms are all provided by the TargetConditionals.h header, and form a heirarchy:

  • TARGET_OS_IPHONE - Generated code will run on a variant of iOS (firmware, devices, simulator)
    • TARGET_OS_IOS - Generated code will run on iOS
      • TARGET_OS_MACCATALYST- Generated code will run on macOS
    • TARGET_OS_TV - Generated code will run on tvOS
    • TARGET_OS_WATCH - Generated code will run on watchOS
  • TARGET_OS_SIMULATOR - Generated code will run on an iOS, tvOS, watchOS, or visionOS simulator

Of particular note: TARGET_OS_IPHONE is any "iPhone like" device - including iOS, tvOS, watchOS, and visionOS. TARGET_OS_IOS is iOS only.

  • Issue: Add support for iOS as a target platform #114099

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@freakboy3742
Add preprocessor declarations to support compiling on iOS.
2b5cd08
@freakboy3742
freakboy3742 requested review from abalkin, ericsnowcurrently and pganssle as code owners February 5, 2024 07:10
@bedevere-app bedevere-app Bot added the awaiting review label Feb 5, 2024
@bedevere-app bedevere-app Bot mentioned this pull request Feb 5, 2024
Add support for iOS as a target platform #114099
Closed
mhsmith
mhsmith reviewed Feb 5, 2024
View reviewed changes
Comment thread Modules/pwdmodule.c
if (uid == 501) {
struct passwd mp;
mp.pw_name = "mobile";
mp.pw_passwd = "/smx7MYTQIi2M";

@mhsmith mhsmith Feb 5, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I see it's easy enough to Google, but there should still be a comment explaining what this value is and where it comes from.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Modules/posixmodule.c
Comment on lines +381 to +384
// iOS/tvOS/watchOS *define* some POSIX methods,
// but raise a compiler error if they are used.
#if TARGET_OS_IPHONE
# undef HAVE_GETGROUPS

@mhsmith mhsmith Feb 5, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

If it's a compiler error, as opposed to a runtime error, then autoconf should be able to detect the problem. The comment should explain why that wasn't sufficient.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Include/internal/pycore_faulthandler.h
Comment on lines +19 to +21
// tvOS and watchOS don't provide a number of important POSIX functions.
#if TARGET_OS_TV || TARGET_OS_WATCH
# undef HAVE_SIGALTSTACK

@mhsmith mhsmith Feb 5, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Same comment as above.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Python/bootstrap_hash.c
Comment on lines +47 to +50
// iOS/tvOS/watchOS *define* some POSIX methods,
// but raise a compiler error if they are used.
#if TARGET_OS_IPHONE
# undef HAVE_GETENTROPY

@mhsmith mhsmith Feb 5, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Same comment as above.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Modules/timemodule.c
Comment on lines +66 to +68
// iOS/tvOS/watchOS *define* clock_settime, but it can't be used
#if TARGET_OS_IPHONE
# undef HAVE_CLOCK_SETTIME

@mhsmith mhsmith Feb 5, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Same comment as above.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@freakboy3742

freakboy3742 commented Feb 6, 2024

Copy link
Copy Markdown
Contributor Author

Prompted by @mhsmith's review, I've dug deeper into how/why configure was incorrectly identifying these functions, and I I've got a cleaner approach for most of this patch. Closing on that basis.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@freakboy3742 freakboy3742 closed this Feb 6, 2024
@freakboy3742
freakboy3742 deleted the iOS-preprocessor branch February 6, 2024 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mhsmith mhsmith mhsmith left review comments
@pganssle pganssle Awaiting requested review from pganssle pganssle is a code owner
@abalkin abalkin Awaiting requested review from abalkin
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@freakboy3742 @mhsmith
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.