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

Build cpython for Mac OSX ARM64 #1373

Merged
merged 1 commit into from
Jun 14, 2023
Merged

Conversation

nightscape
Copy link

I'm not sure if I'm overlooking something, but here's a shot of building cpython for Apple Silicon.
I tried a locally built JAR of this on my MacBook M1 by running the Sample.java file and it correctly printed the formatted date.
@saudet what am I missing? Is it really that easy? 😅

@nightscape nightscape mentioned this pull request Jun 14, 2023
@saudet saudet changed the base branch from master to cpython June 14, 2023 11:06
@saudet saudet merged commit 06b45bf into bytedeco:cpython Jun 14, 2023
5 checks passed
@nightscape
Copy link
Author

@saudet I think I missed changing the architecture to arm64 while configureing CPython.
This worked on my machine because that is a native ARM64 M1 chip, but in Github Actions we're cross-building.
Another question that comes to mind is how the cross-building of NumPy itself would work. It cannot use the published arm64 artifact of CPython because that wouldn't run on x86_64.
Did you already solve this in other places?

@saudet
Copy link
Member

saudet commented Jun 14, 2023

I used crossenv for that before, but it doesn't work with CPython 3.11.

@nightscape
Copy link
Author

Looks like there are more puzzle pieces missing...
python/cpython#23523
Good call in not merging to master 😉
It all seemed too easy 😅

@AutonomicPerfectionist
Copy link
Contributor

@nightscape don't know if you are aware but it seems the recommended procedure for compiling Python on Mac OS is to compile it to a universal2 build, which is a fat build supporting both x86_64 and arm64 Macs. From googling around it seems you can still link to universal2 builds from JNI. Unfortunately I can't test any of this as I don't have a Mac myself, but figured you'd be interested in hearing about it. As for numpy, it seems using crossenv version 1.4 works for Python 11 now, it completes a build for Linux arm without any errors but I have no idea if it works with universal2 builds.

My issue with some info on Linux arm64 builds:

#1381

Issue with some info on compiling Python to universal2:

https://bugs.python.org/issue46749

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.

3 participants