-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 Apple tvOS in libstd #103503
Support Apple tvOS in libstd #103503
Conversation
This comment has been minimized.
This comment has been minimized.
|
☔ The latest upstream changes (presumably #103150) made this pull request unmergeable. Please resolve the merge conflicts. |
I'm interested in moving this along, is there anything I can do to help out @thomcc? Looks like all that is needed right now is a rebase to get the conflicts resolved and then we're just waiting on review |
Yeah and for me to make sure the tests pass, and do another once-over to make sure there's nothing I missed. Nothing needs to be done to push it along; this is part of my project grant so I'm pretty motivated to finish it. I'll probably get to it in another week or two, though. |
@thomcc thank you! |
@thomcc if you've got a full plate we can lend a hand to get this merged |
Anything I can do to help test or help verify? |
I'll be working on it more this weekend, sorry for the delay here everybody. |
☔ The latest upstream changes (presumably #106673) made this pull request unmergeable. Please resolve the merge conflicts. |
I tried to take a few items off ya boi's plate here, so he should be able to get to this soon. Don't worry about this PR too much. Best way to help improve tvOS support at this point is probably hunting down one of the extant iOS bugs and swatting them (due to tvOS's "totally-not-iOS" qualities), or by fixing up something that's been implemented for other OS but not Apple's, like raw-dylib. Easier to work in parallel on (related) issues that way. :3 |
At the risk of sounding annoying, can we help get this done? We really need it |
@bcardarella Yeah, yeah. I've been working on it, sorry for the delay. This is ready for review, and if anybody wants to test they can knock themselves out too. I expect some amount of bugginess but didn't hit it in manual testing (more on that later). The current version seems to work on aarch64 tvOS (aarch64-apple-tvos) and the x86_64 tvOS simulator (x86_64-apple-tvos). I would like to add compiler support for The target definitions in the compiler needed some work in addition to the library work.
In general this is basically just getting them up to snuff with the other Apple targets, and following the normal I've also gone and added an entry to the platform support docs with myself as the target maintainer. These targets already existed with no maintainer, so I don't think I need to recite the new target oath or whatever, but I'm happy to if that would help. CC @rust-lang/compiler The bad news: There isn't a way to run the test suites for these target, so I've just done hello world and some smoke testing. I have some thoughts on how to improve things here in general (for all the apple targets with simulators) but that will be a bit more involved. Such is life for tier3 platforms... Thankfully, this target is very straightforward, mostly just adding cfgs to match iOS. I did take care to ensure the system types ( Things that are less likely to work:
Anyone who hits anything like that should file bugs and CC me, of course. I talked about this with @workingjubilee and she indicated was willing/interested in reviewing it when it's ready. |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
These commits modify compiler targets. |
@bors r=workingjubilee |
☀️ Test successful - checks-actions |
Finished benchmarking commit (f272fc3): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 658.022s -> 659.342s (0.20%) |
@thomcc This is great! Thanks for merging! |
Thank so much for your work. I tried to compile a static library for tvOS with the nightly toolchain (rustc 1.72.0-nightly (5ea6668 2023-06-27)), but encountered a lot of errors when compiling libc. Can you please advise me on how to resolve this? Error example:
|
Interesting. This wasn't an issue when landing it. Just to check, you're building with |
Correct. Since rustup doesn't support to install the pre-built std currently, I had to compile it myself.
The build command is :
|
Yeah, that (rustup target add not working) is normal. The issue is concerning then. It's likely some patch is needed to the |
Note that the libc version in question is 0.2.118, not our main branch's 0.2.146 or the latest 0.2.147 release, so any fix applied to that crate will not affect the version in question. I am forced to wonder if it replicates with a newer version at all? |
Oh, that's a good point. I had assumed this error was occurring during the std-building part of build-std. If this is in another crate, you'll need to ensure your dependency graph is pulling in a suitably new version of libc. You can probably force this by running something like |
If both of those foil you there is also the "heavy" solution of using |
Thanks again to both of you. I was not aware that the But when compiling the
|
It looks like maybe ring is using... nonportable assembler directives, perhaps? Or the build was supposed to use a different assembler than the one it actually had access to. Either way, it indeed probably isn't anything to fix in std. |
You are right. I made a patch to fix the issue by adding the missing judgment about the target However, in |
Yes, there's nothing It's a bit unfortunate, but code wanting to future-proof might want to use |
This target has existed in the compiler for a while, was
no_std
-only previously (even requiring#![feature(restricted_std)]
). Apple tvOS is essentially the same as iOS, down to using the same version numbering, so there's no reason for this to be ano_std
-only target the way it is currently.Not yet tested much (I have an Apple TV, but haven't tested that this can deploy and run programs on it, nor the simulator). Uses the implementation strategy as the watchOS support in #98101 and etc. That is, no
std::os::
interfaces aside from those instd::os::unix
.Includes an update to libc in order to pull in rust-lang/libc#2958.