-
Notifications
You must be signed in to change notification settings - Fork 622
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/12578
Note: Links to docs will display an error until the docs builds have been completed. ❌ 11 New Failures, 3 Unrelated FailuresAs of commit 4ac87e3 with merge base 986be2a ( NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
might want to pick this to release, not sure. comes from #10768 |
I think ios.toolchain.cmake is probably poor naming, but it is a general Apple cmake toolchain to build for all of their platforms (controlled via PLATFORMS): https://github.com/leetal/ios-cmake |
using this toolchain breaks sentencepiece's build in the next PR. Why aren't CMake's default settings on macOS sufficient? |
@shoumikhin do you have context on why we use the toolchain instead of relying the on the default host configs? |
@@ -12,7 +12,6 @@ | |||
"inherits": ["common"], | |||
"generator": "Xcode", | |||
"cacheVariables": { | |||
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/third-party/ios-cmake/ios.toolchain.cmake", |
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.
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 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.
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:
- Despite its name, this toolchain isn’t limited to iOS.
- The last time I tried building the frameworks by manually setting all the macOS-specific flags myself - it ended up costing way more time 😅
- Otherwise, this toolchain has worked well so far.
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.
build-frameworks-ios error:
so I guess this script might need CMAKE_TOOLCHAIN_FILE put back? |
I don't know why we were doing this, but it seems wrong. Let's see if tests pass.