Skip to content

Accept macOS triples in the Apple OS version split - #166

Merged
auscompgeek merged 2 commits into
robotpy:mainfrom
MementoRC:apple-darwin-triple
Oct 17, 2026
Merged

auscompgeek merged 2 commits into
robotpy:mainfrom
MementoRC:apple-darwin-triple

Conversation

@MementoRC

@MementoRC MementoRC commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

crossenv 1.6.1 cannot set up a cross-python for any macOS host. _split_apple_os_version whitelists only ios, tvos and watchos, so every *-apple-darwin* triple reaches the raise:

ERROR: Unknown Apple compiler triple.

The unconditional path is _clean_triple, which calls it for any triple whose vendor is apple, from find_compiler_info's -dumpmachine sanity check. That check is only meant to warn ("We won't overcomplicate this, since it's just to generate a warning"), but the call is not guarded, so the exception aborts setup instead. get_uname_info's host_platform fallback hits the same raise when _PYTHON_HOST_PLATFORM is empty.

1.5.0 had no Apple branching here and was unaffected.

With darwin handled, the rest of the macOS path already works: host_machine comes from the triple's CPU field, host_release from MACOSX_DEPLOYMENT_TARGET, and sysconfig_platform from the existing host_sys_platform == "darwin" branch. The version returned for macOS is the Darwin kernel version and is not read on that path; stripping it also makes the warning comparison correct, since clang reports the running kernel (x86_64-apple-darwin24.6.0) while HOST_GNU_TYPE carries the SDK one (x86_64-apple-darwin13.4.0), and both now reduce to x86_64-apple-darwin.

Seen on conda-forge cross-compiling osx-64 from osx-arm64 with crossenv 1.6.1. There is no macOS lane in CI, so this is not covered by the test matrix.

Adjacent, not touched here: MACOSX_DEPLOYMENT_TARGET majors other than 10 and 11 raise a few lines further down, which would break a 12.0+ target.

@MementoRC

Copy link
Copy Markdown
Contributor Author

Passing tests are inconclusive here, no macos lanes

@MementoRC

Copy link
Copy Markdown
Contributor Author

@isuruf This just occurred, it felt similar enough to #165 to investigate and PR

@sea-bass

sea-bass commented Sep 15, 2026 •

Copy link
Copy Markdown

psavery added a commit to HEXRD/hexrd that referenced this pull request Sep 15, 2026
crossenv 1.6.1 (conda-forge, 2026-09-14) rejects every *-apple-darwin*
triple with "Unknown Apple compiler triple", aborting all osx-arm64
cross builds in the MacOSX packaging job. Pin to the previous release
until robotpy/crossenv#166 is released on conda-forge.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>

@isuruf isuruf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be better to do something like

offset = next((i for i, c in enumerate(value) if c.isdigit()), None)

Then we can also allow something like macos too. the triple can be x86_64-apple-macos11.0 sometimes

@MementoRC

Copy link
Copy Markdown
Contributor Author

Indeed, a new test accompanies it since the 'no macos lane' comment is irrelevant

Comment thread tests/test_triples.py Outdated
Covers darwin, macos and other Apple OS names without a fixed list.
Make the triple helpers static/class methods and add unit tests for the
split and triple cleanup.
@MementoRC
MementoRC force-pushed the apple-darwin-triple branch from 38bda56 to 275d14e Compare October 13, 2026 19:22
ZackAttack614 pushed a commit to HEXRD/hexrd that referenced this pull request Oct 14, 2026
crossenv 1.6.1 (conda-forge, 2026-09-14) rejects every *-apple-darwin*
triple with "Unknown Apple compiler triple", aborting all osx-arm64
cross builds in the MacOSX packaging job. Pin to the previous release
until robotpy/crossenv#166 is released on conda-forge.

Signed-off-by: Patrick Avery <patrick.avery@kitware.com>

@auscompgeek auscompgeek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@auscompgeek
auscompgeek merged commit 9dafa75 into robotpy:main Oct 17, 2026
12 checks passed
@MementoRC
MementoRC deleted the apple-darwin-triple branch October 17, 2026 14:30
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.

4 participants