-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Support tvOS and watchOS (and simulator) targets #48862
Comments
Starting from the iOS implementation in rustc, I got i386 and armv7k for watchos to compile and link in Xcode 10.2 beta 3. It requires quite a few modifications to support the Unfortunately, this isn't sufficient for Apple Store release... Apple now requires a new As mentionned in #35968, in order to prevent this never ending catching up on Xcode, I think using Swift's llvm is the only way to fully support Apple ecosystem... |
Would it be feasible to add a |
@appaquet Would you be able to share how you managed to compile and link for armv7k? |
@pruthvikar Unfortunately it's been a while and I haven't touched it since, so I may not be very helpful... But here are the changes I had made on rustc: master...appaquet:watchos But as I had mentioned, arm64_32 was impossible to target since it required changes that had not been merged in LLVM back when I tested it. |
That should come in very handy, thanks! |
Added tvOS as targets This is a first attempt of adding support tvOS as described in #48862. It's got a lot of overlap with [src/librustc_target/spec/apple_ios_base.rs](https://github.com/rust-lang/rust/blob/31dd4f4acbcbdb02b0745d2136399ed664a28050/src/librustc_target/spec/apple_ios_base.rs). I thought about refactoring `apple_ios_base.rs` to include this as well but that would require each of the ios and tvos targets to be of the something like the form `let base = opts(AppleOS::TV, Arch::Arm64)?;` I also did the same thing for watchOS because from what I can tell, all three targets (iOS, tvOS, and watchOS) have the same logic but have different parameters being sent to `xcrun`. Thoughts? As far as the `data_layout` and other parameters to `Target`, I did as much research as I could but it really seems that processor in the [iPhone 11 is the same as the apple TV](https://en.wikipedia.org/wiki/Apple-designed_processors) so I didn't change any of those parameters. I did get this to build and tested that it's actually running the the below logic (because the parameter to `xcrun` is `appletvos` not `tvos`). I didn't manage to get it to actually compile a file with `fn main(){}` because I don't have the stdlib for `aarch64-apple-tvos` compiled it seems. Is there documentation for this? Similar to the ending of #63467, I'm not sure what to do next.
Added tvOS as targets This is a first attempt of adding support tvOS as described in rust-lang#48862. It's got a lot of overlap with [src/librustc_target/spec/apple_ios_base.rs](https://github.com/rust-lang/rust/blob/31dd4f4acbcbdb02b0745d2136399ed664a28050/src/librustc_target/spec/apple_ios_base.rs). I thought about refactoring `apple_ios_base.rs` to include this as well but that would require each of the ios and tvos targets to be of the something like the form `let base = opts(AppleOS::TV, Arch::Arm64)?;` I also did the same thing for watchOS because from what I can tell, all three targets (iOS, tvOS, and watchOS) have the same logic but have different parameters being sent to `xcrun`. Thoughts? As far as the `data_layout` and other parameters to `Target`, I did as much research as I could but it really seems that processor in the [iPhone 11 is the same as the apple TV](https://en.wikipedia.org/wiki/Apple-designed_processors) so I didn't change any of those parameters. I did get this to build and tested that it's actually running the the below logic (because the parameter to `xcrun` is `appletvos` not `tvos`). I didn't manage to get it to actually compile a file with `fn main(){}` because I don't have the stdlib for `aarch64-apple-tvos` compiled it seems. Is there documentation for this? Similar to the ending of rust-lang#63467, I'm not sure what to do next.
Added tvOS as targets This is a first attempt of adding support tvOS as described in rust-lang#48862. It's got a lot of overlap with [src/librustc_target/spec/apple_ios_base.rs](https://github.com/rust-lang/rust/blob/31dd4f4acbcbdb02b0745d2136399ed664a28050/src/librustc_target/spec/apple_ios_base.rs). I thought about refactoring `apple_ios_base.rs` to include this as well but that would require each of the ios and tvos targets to be of the something like the form `let base = opts(AppleOS::TV, Arch::Arm64)?;` I also did the same thing for watchOS because from what I can tell, all three targets (iOS, tvOS, and watchOS) have the same logic but have different parameters being sent to `xcrun`. Thoughts? As far as the `data_layout` and other parameters to `Target`, I did as much research as I could but it really seems that processor in the [iPhone 11 is the same as the apple TV](https://en.wikipedia.org/wiki/Apple-designed_processors) so I didn't change any of those parameters. I did get this to build and tested that it's actually running the the below logic (because the parameter to `xcrun` is `appletvos` not `tvos`). I didn't manage to get it to actually compile a file with `fn main(){}` because I don't have the stdlib for `aarch64-apple-tvos` compiled it seems. Is there documentation for this? Similar to the ending of rust-lang#63467, I'm not sure what to do next.
Added tvOS as targets This is a first attempt of adding support tvOS as described in #48862. It's got a lot of overlap with [src/librustc_target/spec/apple_ios_base.rs](https://github.com/rust-lang/rust/blob/31dd4f4acbcbdb02b0745d2136399ed664a28050/src/librustc_target/spec/apple_ios_base.rs). I thought about refactoring `apple_ios_base.rs` to include this as well but that would require each of the ios and tvos targets to be of the something like the form `let base = opts(AppleOS::TV, Arch::Arm64)?;` I also did the same thing for watchOS because from what I can tell, all three targets (iOS, tvOS, and watchOS) have the same logic but have different parameters being sent to `xcrun`. Thoughts? As far as the `data_layout` and other parameters to `Target`, I did as much research as I could but it really seems that processor in the [iPhone 11 is the same as the apple TV](https://en.wikipedia.org/wiki/Apple-designed_processors) so I didn't change any of those parameters. I did get this to build and tested that it's actually running the the below logic (because the parameter to `xcrun` is `appletvos` not `tvos`). I didn't manage to get it to actually compile a file with `fn main(){}` because I don't have the stdlib for `aarch64-apple-tvos` compiled it seems. Is there documentation for this? Similar to the ending of #63467, I'm not sure what to do next.
|
From https://doc.rust-lang.org/nightly/rustc/platform-support.html, |
Hi! Is support for Rust |
I'm also curious about what's needed to make |
See #103503 Closing. |
Great, @workingjubilee ! I'm happy to see this! |
am I understanding this issue as indicating that the TvOS simulator is supported? We cannot compile to it but we can compile directly to TvOS |
Just to confirm I'm on the correct version of rustc:
|
The tuple naming may be somewhat nonintuitive. The |
@workingjubilee you're right, let me dig in and see why we're not able to compile for the simulator. Thank you for the quick reply |
@workingjubilee wouldn't the |
For example, if I get the compiler targets for WatchOS:
it includes both the x86 and aarch64 targets for the simulator |
Uhhh, it probably seems obvious to you, but for some reason I am missing the last 20% of context here so I'm not immediately certain what you're actually asking. Which is the other reason why I suggested you open a new issue: It would be nice to see the full "problem statement" ("I want to do X, I tried Y, it didn't work, this was what the compiler vomited out"). You can @ me in that issue if you want my attention specifically, but it is also more likely to get attention in general, because it will be visible to people immediately triaging the issues (especially recently-opened ones). And we may need to determine it's a regression and triage it as such and so on. |
Apple's division of OS targets is a bit odd: apps for iPhones and iPads both use an iOS or "iPhoneOS" target, but watchOS and tvOS are treated as entirely separate targets or "platforms".
rustc currently supports macOS (
{x86_64,i686}-apple-darwin
), iOS ({armv7,armv7s,aarch64}-apple-ios
), and the iOS Simulator (i386-apple-ios
), but not tvOS or watchOS.Here's the full list of platforms. (I'm not sure if the version-min argument is needed for rustc, but it would be needed in
cc-rs
, which is also missing support.)Edit (9/10/19): Changes since this was originally posted:
-simulator
in the LLVM triple, e.g.x86_64-apple-tvos12.4.0-simulator
x86_64-apple-ios13.0-macabi
. It still uses the macOS SDK, but with a custom header/library search path.arm64_32
; example LLVM triple:arm64_32-apple-watchos6.0.0
.-mxxx-version-min
MacOSX
x86_64-apple-macosx10.13.0
-mmacosx-version-min
or-mmacos-version-min
iPhoneOS
arm64-apple-ios11.2.0
-miphoneos-version-min
or-mios-version-min
iPhoneOSSimulator
x86_64-apple-ios11.2.0
-miphonesimulator-version-min
or-mios-simulator-version-min
WatchOS
thumbv7k-apple-watchos4.2.0
-mwatchos-version-min
WatchSimulator
x86_64-apple-watchos4.2.0
-mwatchsimulator-version-min
or-mwatchos-simulator-version-min
AppleTVOS
arm64-apple-tvos11.2.0
-mappletvos-version-min
or-mtvos-version-min
AppleTVSimulator
x86_64-apple-tvos11.2.0
-mappletvsimulator-version-min
or-mtvos-simulator-version-min
Example output of
xcodebuild -showsdks
:The text was updated successfully, but these errors were encountered: