Add aarch64-apple-visionos and aarch64-apple-visionos-sim tier 3 targets - #121419
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
|
These commits modify compiler targets. This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. |
This comment has been minimized.
This comment has been minimized.
|
There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged. You can start a rebase with the following commands: The following commits are merge commits: |
This comment has been minimized.
This comment has been minimized.
|
Great work @agg23 |
|
@eugenehp It sounds like you might have built something incorrectly. Since you're using If you run (note, this needs to be the custom built toolchain's amongst the other options. Beware that you cannot build If you want to work on visionOS now, I have published instructions on how to set it up. I have tested this both in the simulator and on an actual headset. |
| data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".into(), | ||
| arch: arch.target_arch(), | ||
| options: TargetOptions { | ||
| features: "+neon,+fp-armv8,+apple-a7".into(), |
There was a problem hiding this comment.
I suspect that this can be much higher, possibly even apple-a15 or apple-m2?
Same for the simulator target.
There was a problem hiding this comment.
Very good point. Do you know how I would find out what is acceptable? Just poking around in LLVM?
There was a problem hiding this comment.
There was a problem hiding this comment.
I am unsure why, but in use rustc reports that apple-m1 is not a valid feature for this target. I see nothing obvious in the codebase where we whitelist LLVM architectures.
Reverting to the latest available in rustc, apple-a16
|
Is there a recommended way for testing a no |
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Are visionos toolchains available through rustup standard release channels? If not, what would this take? |
No, you'll need to use
It would take an MCP to raise the target to Tier 2, see the policy. I'm a bit weary about doing so myself, because I don't feel that visionOS is sufficiently supported, especially so in the broader ecosystem. But I could be persuaded otherwise. |
|
I would concur that visionOS is not sufficiently supported, and while the platform support is simple, it is extremely sparingly tested. I'd be surprised if more than 10-20 people have actually tried building their own projects using |
|
We're the ones who pushed for this target to be added to Rust as we're using it in LiveView Native. And there's more than 10 - 20 people using it. |
|
we use it too for a bunch of internal projects. |
|
We plan to use it for research projects too using the Rust-based Automerge framework.Sendt fra min iPhoneDen 3. jan. 2025 kl. 16.15 skrev Eugene Hauptmann ***@***.***>:
we use it too for a bunch of internal projects.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
Our use case is this: take a large C++ application that runs on desktop, mobile, embedded, and visionOS platforms and integrate new foundational components written in Rust. We need to build those new components for visionOS if all features of the application are to remain cross-platform. |
|
I appreciate the feedback here, it's interesting to hear about the places people are using this. I'm unsure of what would be necessary for me to really consider visionOS well supported (and I won't be the one making the decision anyhow). I guess one indicator, though not necessarily a good one, is how used it is (so do feel free to continue posting here if you use the target, and would like it to become Tier 2). |
|
Another indicator, like I alluded to before, is the ecosystem support. To get a measure of the current support here, I went and compiled the crates in here and here (in a VM, I'm not that reckless ;) ), filtered out the ones that didn't support macOS, and found the following crates that didn't support iOS nor visionOS:
And the following that don't support visionOS at the time of writing:
(This list excludes crates that didn't built because they hadn't updated a dependency to an updated version that has visionOS support, so might be under-representative). Idk., I compiled this list mostly because I was curious, I don't expect people here to go and fix those crates (though that would be cool), I meant it more as a showcase of where we are currently. |
|
Another current problem for me at least is that Rust's test suite is fairly difficult to run for cross-compiled targets, and especially so for these devices where it cannot be tested without sending it to the simulator. And yes, that's also a problem on iOS, but those targets are a) much more widely used, and b) we can use Mac Catalyst to somewhat test parts of it. |
|
@madsmtm well, it just seems like it comes down to if you want to do it or not and it feels lke you don't want to do it. FWIW our needs are met in the current state. |
|
Does using this target involve creating a custom build of the Rust compiler? Are there any step-by-step instructions on how to do it? I would love to use it, but wouldn't know where to start. |
Nah, you shouldn't need to compile the rust compiler yourself. You'll need to use the Liveview Native Core is an example of a project using visionOS. Getting the rust into a visionOS simulator or an actual device is a bit trickier. Last time I touched this PR to |
|
FYI, I've now filed rust-lang/compiler-team#918 for promoting the |

Introduces
aarch64-apple-visionosandaarch64-apple-visionos-simas tier 3 targets. This allows native development for the Apple Vision Pro's visionOS platform.This work has been tracked in rust-lang/compiler-team#642. There is a corresponding
libcchange rust-lang/libc#3568 that is not required for merge.Ideally we would be able to incorporate this change to the
objectcrate, but the author has stated that a release will not be cut for quite a while. Therefore, the two locations that would reference the xrOS constant fromobjectare hardcoded to their MachO values of 11 and 12, accompanied by TODOs to mark the code as needing change. I am open to suggestions on what to do here to get this checked in.Tier 3 Target Policy
At this tier, the Rust project provides no official support for a target, so we place minimal requirements on the introduction of targets.
See src/doc/rustc/src/platform-support/apple-visionos.md
This naming scheme matches
$ARCH-$VENDOR-$OS-$ABIwhich is matches the iOS Apple Silicon simulator (aarch64-apple-ios-sim) and other Apple targets.This contribution is fully available under the standard Rust license with no additional legal restrictions whatsoever. This PR does not introduce any new dependency less permissive than the Rust license policy.
The new targets do not depend on proprietary libraries.
This new target mirrors the standard library for watchOS and iOS, with minor divergences.
Documentation is provided in src/doc/rustc/src/platform-support/apple-visionos.md
I acknowledge these requirements and intend to ensure that they are met.
This target does not touch any existing tier 2 or tier 1 targets and should not break any other targets.