Skip to content

Conversation

@zanieb
Copy link
Member

@zaniebzanieb commented Sep 7, 2024

Following up on #319 — adds a patch to support cross-compilation as we do for previous Python versions.

@zanieb
Copy link
MemberAuthor

@indygreg could you give me some context on testing this since it's not needed for CI to pass?

Copy link
Collaborator

@indygregindygreg left a comment

Choose a reason for hiding this comment

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

You test this by passing --target-triple to ./build-macos.py targeting the non-native target. So from Apple Silicon you want --target-triple x86_64-apple-darwin to cross-compile to x86-64. A working build is almost certainly sign of success.

To test from CI, you could switch the macOS runners to a new/old version to force cross-compiles. PGO and BOLT would stop working. But it otherwise should just work.

@zanieb
Copy link
MemberAuthor

Ah okay that makes sense — I was wondering why CI didn't cross compile if we were patching for it and thought maybe this was for some other target.

This fails for me:

cpython-3.13> configure: error: cross build not supported for x86_64-apple-darwin

I'll play with the patch some more.

@indygreg
Copy link
Collaborator

CPython's build system has historically made some questionable decisions about how to build on/for Apple platforms. e.g. they've historically not supported cross-compiling (unless doing a multi-arch "universal" build) despite cross-compiling for Apple platforms being probably one of the easiest platforms to cross-compile for!

My guess is they tweaked more configure checks in this area (possibly as part of shoring up iOS support) and created more work for us in the process.

We don't need to support cross-compiles anymore. Historically I needed it because GitHub Actions didn't have macOS ARM runners. At the moment we have x86-64 and ARM macOS runners and all is well.

@zanieb
Copy link
MemberAuthor

It actually is really nice to be able to cross-compile so I can test the x86_64 builds from my laptop. Our builds are also slowed down by GitHub's concurrent macOS job limit (only 5). There are alternative platforms that provide macOS runners that would let us have a higher concurrency limit, but they only support ARM. I'll probably try to fix it slowly.

@zanieb
Copy link
MemberAuthor

Alright turned out to be pretty easy, works locally.

@zaniebzanieb merged commit 523c1ed into mainSep 8, 2024
Sign up for freeto 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

@zanieb@indygreg