-
Notifications
You must be signed in to change notification settings - Fork 623
Don't use iOS toolchain on macOS #12578
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
iirc, this is not iOS-only toolchain, we use it to build mac targets too.
It contains a bunch of useful declarations to simplify our live, e.g. the very
MAC_ARM64
platform definition.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.
This is not the normal way that CMake projects expect to build for Mac though. concretely, sentencepiece's build does not like CMAKE_MACOSX_BUNDLE being set on non-iOS platforms, and it wouldn't be set on macOS if not for the use of this toolchain. IMO we should keep everything standard and defaulted unless we have a reason not to. Why do we need to use this to build for Mac?
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.
So we rely on that toolchain platform definitions with the extra cmake flags they add to build frameworks for iOS and macOS. So far they worked well. If you believe there's a better approach, let's explore it too.

I guess we can disabled CMAKE_MACOSX_BUNDLE for sentencepiece specifically when building for mac, that's what we do with the custom script build phase in Xcode when building extension/llm third-party deps.
Uh oh!
There was an error while loading. Please reload this page.
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 agree that we can work around this and it's straightforward to do so. My concern is that the setting of this toolchain cost me half an hour of debugging time to track down, because it was surprising that 1) any toolchain was active for macos, since builds work fine without it when not using presets, and 2) "ios.toolchain.cmake" in particular was active. This will presumably continue to be surprising to others in the future.
What if instead we set the CMAKE_TOOLCHAIN_FILE only in build_apple_frameworks.sh? Do we need it anywhere else? (Long-term I think we should investigate using CMake's built-in support for producing Apple frameworks, but I don't see a particular reason to prioritize that.)
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 don’t have a strong preference - so long as we can build the frameworks as usual, I’m happy either way.
Just a few quick notes:
Maybe just disable that particular flag like in #12594
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.
Hmm, maybe #12594 will unblock me. If not I'll see if I can find another way to unblock export since I've found out that this is here for a reason and not just a mistake.
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.
Yep, I rebased and it looks like we don't need this.