Skip to content

visionOS Support #270

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

Merged
merged 22 commits into from
Apr 23, 2025
Merged

visionOS Support #270

merged 22 commits into from
Apr 23, 2025

Conversation

johnzhou721
Copy link
Contributor

@johnzhou721 johnzhou721 commented Apr 15, 2025

Refs #269, fixes #207, cross-refs freakboy3742/cpython#6
Old PR but on a different branch than main.

Sorry for the main stuff.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@johnzhou721 johnzhou721 marked this pull request as ready for review April 15, 2025 01:39
@johnzhou721
Copy link
Contributor Author

So the makefile is coming all together but we deleted the pyconfig.h shim which affects some stuff.

@johnzhou721
Copy link
Contributor Author

I mean in PAS

@johnzhou721
Copy link
Contributor Author

oops sorry this IS the PAS repo
Just added an if condition to not do the pyconfig.h business on vision pro, testing it

@johnzhou721
Copy link
Contributor Author

Oops forgot a space after a comma in a Makefile

Guess what 1 minute wasted, make clean and making

@johnzhou721
Copy link
Contributor Author

ok great this is fixed now so PAS builds!

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

A couple of minor tweaks from a first-pass review; I need to run this locally to confirm the patch is accurate.

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
@johnzhou721
Copy link
Contributor Author

OS_LOWER-$(target) is still needed for sitecustomize stuff which I do not have much familiarity with.

OS_LOWER-$(sdk) is gotten rid of in the commit I will push after it finishes testing. TRIPLE_OS-$(sdk) is also gotten rid of

@johnzhou721
Copy link
Contributor Author

done

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Can confirm this successfully completes a build.

There are, however, a lot of warnings that follow this general pattern:

ld: warning: object file (/Users/rkm/beeware/support/Python-Apple-support/install/visionOS/xros.arm64/openssl-3.0.16-1/lib/libcrypto.a[2](libcrypto-lib-aes_cbc.o)) was built for newer 'visionOS' version (2.0) than being linked (1.0)

That is - the CPython module is being compiled with an xrOS deployment minimum of 1.0, but libcrytpo was compiled with a minimum of 2.0. The same error is raised for all other binary dependencies.

I suspect the cause is that XROS_DEPLOYMENT_TARGET isn't being defined, so the arm64-apple-xros-clang shim isn't enforcing the right minimum version.

The other issue: It needs the modifications to CI to include a visionOS build.

@johnzhou721
Copy link
Contributor Author

Can confirm. Same thing with LZMA

@johnzhou721
Copy link
Contributor Author

XROS_DEPLOYMENT_TARGET is being checked for in the configure script.

@johnzhou721
Copy link
Contributor Author

will push after local test

@johnzhou721
Copy link
Contributor Author

OK but this is building .so not .dylib for some reason.

@johnzhou721
Copy link
Contributor Author

Nevermind -- those ARE .dylib format but under the name of .so.

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

The mechanics of the patch all look good; the only detail that is outstanding is the exact contents of Python.patch, which is dependent on finalizing freakboy3742/cpython#6.

@johnzhou721
Copy link
Contributor Author

OK the old commit had an issue... redid it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

visionOS stuff on Unable to initialize Python interpreter: failed to initialize importlib also happened on iOS.. Otherwise LGTM also

@johnzhou721
Copy link
Contributor Author

johnzhou721 commented Apr 20, 2025

FYI: I've also been translating stuff for Simplified Chinese through Weblate, but I consider Discord a bad thing so I did not introduce myself in Discord; I hope that this is forgivable. I might make some occasional mistakes (md >>>>> rst, also why isn't bold and italics (bad practice for chinese to use italic I guess) working?) and do some useless stuff at first (such as rewording things minorly to sound just a bit more casual like described in the instructions), and I apologize in advance.

I was born in Mainland China and lived there for 11 years, and spoke Mandarin and wrote in Simplified Chinese (often using pen(cil) and paper which is sort of strenuous, looking at it now).

@johnzhou721
Copy link
Contributor Author

Also this is late but happy easter!

@johnzhou721
Copy link
Contributor Author

@freakboy3742 Added logic for building on macOS first and using that as the build_python -- hopefully this fixes the iOS issue. We'll see.

Makefile Outdated
Comment on lines 123 to 127
# In addition, a macOS build Python for the current architecture is
# also generated here; those won't need fancy dependencies just to
# build another Python. We need this because sometimes, the patches
# are so dramatic that a Python of the same MAJOR.MINOR on our system
# is no longer applicable.
Copy link
Member

Choose a reason for hiding this comment

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

Good idea, but we're already downloading a pre-compiled Python install; ideally we'd be using that version, rather than having to compile a full interpreter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh sorry for doing that again -- replying you in another thread.

But right now at least before Betas, this is not an ideally situation.

@freakboy3742
Copy link
Member

I've reverted the change you've made to make the macOS version a dependency. It's a good idea, but orthogonal to this PR, and the implementation that you provided needed some work. For now, it's easier to update the patch to use Python 3.14.0a7. I'm building dependency packages right now, as soon as those are done, I'll push an update to this branch (and likely merge)

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

And it looks like it all works! Thanks for your work on this - it's much appreciated!

@freakboy3742 freakboy3742 merged commit 92d8d95 into beeware:main Apr 23, 2025
8 of 12 checks passed
@johnzhou721
Copy link
Contributor Author

johnzhou721 commented Apr 23, 2025 via email

@freakboy3742
Copy link
Member

I'm not seeing any failures at my end - which tests are failing for you?

@johnzhou721
Copy link
Contributor Author

Wait how are you reproducing my build? Are you running it from cpython repo per se or using PAS?

@freakboy3742
Copy link
Member

I'm using the test makevisionos target on the freakboy3742 3.14-patched branch. That includes the changes that you contributed, plus some additional bug fixes that Ianded late yesterday just before merging the PR. Those additional bug fixes resolved 3 test failures that were in the last version of the patch that you pushed, and restored support for the webbrowser module.

@johnzhou721
Copy link
Contributor Author

@freakboy3742 Oh, sorry, I did not fetch. Yep that should resolve matters, thank you!

@johnzhou721
Copy link
Contributor Author

Hold on... I caught an error in the Makefile... will open new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

visionOS support
2 participants