Skip to content
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

Failed to build aarch64-apple-tvos target #121640

Closed
arttet opened this issue Feb 26, 2024 · 9 comments · Fixed by #123723 or #125935
Closed

Failed to build aarch64-apple-tvos target #121640

arttet opened this issue Feb 26, 2024 · 9 comments · Fixed by #123723 or #125935
Labels
C-bug Category: This is a bug. O-tvos Operating system: tvOS (including simulator) T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@arttet
Copy link
Contributor

arttet commented Feb 26, 2024

I tried to build aarch64-apple-tvos, x86_64-apple-tvos, aarch64-apple-tvos-sim targets.
Unfortunately, I got

the following errors:

  error: methods `as_raw_stat`, `st_birthtime`, `st_birthtime_nsec`, `st_flags`, `st_gen`, and `st_lspare` are never used
    --> library/std/src/os/ios/fs.rs:29:8
     |
  15 | pub trait MetadataExt {
     |           ----------- methods in this trait
  ...
  29 |     fn as_raw_stat(&self) -> &raw::stat;
     |        ^^^^^^^^^^^
  ...
  60 |     fn st_birthtime(&self) -> i64;
     |        ^^^^^^^^^^^^
  61 |     #[stable(feature = "metadata_ext2", since = "1.8.0")]
  62 |     fn st_birthtime_nsec(&self) -> i64;
     |        ^^^^^^^^^^^^^^^^^
  ...
  68 |     fn st_flags(&self) -> u32;
     |        ^^^^^^^^
  69 |     #[stable(feature = "metadata_ext2", since = "1.8.0")]
  70 |     fn st_gen(&self) -> u32;
     |        ^^^^^^
  71 |     #[stable(feature = "metadata_ext2", since = "1.8.0")]
  72 |     fn st_lspare(&self) -> u32;
     |        ^^^^^^^^^
     |
     = note: `-D dead-code` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(dead_code)]`
  
  error: method `set_created` is never used
     --> library/std/src/os/ios/fs.rs:151:8
      |
  148 | pub trait FileTimesExt: Sealed {
      |           ------------ method in this trait
  ...
  151 |     fn set_created(self, t: SystemTime) -> Self;
      |        ^^^^^^^^^^^
  
  
  Did not run successfully: exit status: 1

How to reproduce

./configure \
		--enable-option-checking \
		--tools=cargo,clippy,rustdoc,rustfmt,rust-analyzer,analysis,src \
		--target=aarch64-apple-tvos,x86_64-apple-tvos,aarch64-apple-tvos-sim \
		--set llvm.download-ci-llvm=true \
		--set build.verbose=1 \
		--set rust.channel=dev \
		--dist-compression-formats=xz \
		--prefix=install

According to the docs, the target maintainer is @thomcc

@arttet arttet added the C-bug Category: This is a bug. label Feb 26, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 26, 2024
@saethlin saethlin added T-libs Relevant to the library team, which will review and decide on the PR/issue. Libs-Small Libs issues that are considered "small" or self-contained O-tvos Operating system: tvOS (including simulator) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Feb 26, 2024
@saethlin
Copy link
Member

saethlin commented Feb 26, 2024

I think you can just add --set rust.deny-warnings=false. Those look like warnings that are treated as errors in the default config.

The code still needs maintenance, but maybe that unblocks you.

@Rajveer100
Copy link
Contributor

@saethlin
Can you describe a bit about this?

@saethlin
Copy link
Member

tvos is a tier 3 target, which means that it may not have any CI. In this case, it looks like it doesn't. The support tiers are documented and explained here: https://doc.rust-lang.org/nightly/rustc/platform-support.html

The default build configuration used by x.py, the bootstrap entrypoint, is to build the compiler and library with -Dwarnings. We have an option to turn this off, i.e. to treat warnings as warnings. The person who reported this issue is not actually encountering a bug, they are just tripping over an unfortunate default. Building the library and compiler with x.py is primarily intended for developers of the compiler and standard library, not for end users. We deny warnings in CI, so the default dev setup matches CI.

If you want to use the tvos targets, they build perfectly fine using -Zbuild-std, which should be the normal way to use a Tier 3 target: cargo +nightly build -Zbuild-std --target=aarch64-apple-tvos will locally build the standard library for the aarch64 tvOS target. The distributed rustc is a cross-compiler that supports all our targets, you never need to rebuild the compiler in order to use any of the built-in targets, meaning the contents of rustc +nightly --print target-list.

Is there something more specific you want to know?

@Rajveer100
Copy link
Contributor

What's your suggestion in terms of fixing this issue?

@saethlin
Copy link
Member

add --set rust.deny-warnings=false

As I said above.

Alternatively, you could contribute the rest of the tvos std implementation.

@Rajveer100
Copy link
Contributor

Can you describe a bit about this?

@saethlin
I was actually asking in terms of opening a PR for this, what's the way to go about this?

@saethlin
Copy link
Member

saethlin commented Apr 8, 2024

Oh, are you asking because I labeled this easy 🤦

Actually making these functions used is not easy, and probably amounts to "finish the TvOS support". What I was thinking of then was that OP needs to add the flag I mentioned above, and that wherever they got that command needs to be adjusted.

@saethlin saethlin removed E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. Libs-Small Libs issues that are considered "small" or self-contained labels Apr 8, 2024
@Rajveer100
Copy link
Contributor

Well, no worries although I would still be happy to contribute if you think it's approachable despite it not being a good-first-issue.

@saethlin
Copy link
Member

It's approachable, but would be best done with some advice from the target maintainer, @thomcc: It looks like a bunch of filesystem metadata functions are unused in the tvos target. Is there missing implementation? Whats' the general strategy for finishing the implementation up?

@bors bors closed this as completed in 0968298 Jul 14, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Jul 16, 2024
Merge Apple `std::os` extensions modules into `std::os::darwin`

The functionality available on Apple platforms are very similar, and were (basically) duplicated for each platform.

This PR rectifies that by merging the code into one module.

Ultimately, I've done this to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings.

Publically exposing these to tvOS/watchOS/visionOS targets is considered in rust-lang/rust#123723, but that seems to be dragging out, and in any case I think it makes sense to do the refactor separately from stabilization.

r? libs

Fixes rust-lang/rust#121640 and rust-lang/rust#124825.
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Jul 16, 2024
Merge Apple `std::os` extensions modules into `std::os::darwin`

The functionality available on Apple platforms are very similar, and were (basically) duplicated for each platform.

This PR rectifies that by merging the code into one module.

Ultimately, I've done this to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings.

Publically exposing these to tvOS/watchOS/visionOS targets is considered in rust-lang/rust#123723, but that seems to be dragging out, and in any case I think it makes sense to do the refactor separately from stabilization.

r? libs

Fixes rust-lang/rust#121640 and rust-lang/rust#124825.
bors added a commit to rust-lang-ci/rust that referenced this issue Nov 3, 2024
Make `std::os::darwin` public

I'm not sure of the reasoning behind them not being public before, but I think they should be, just like `std::os::ios` and `std::os::macos` are public.

Additionally, I've merged their source code, as it was otherwise just a bunch of unnecessary duplication.

Ultimately, I've done this PR to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings.

Since you reviewed rust-lang#121419
r? davidtwco

Fixes rust-lang#121640.

`@rustbot` label O-tvos O-watchos O-visionos
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Nov 9, 2024
Make `std::os::darwin` public

I'm not sure of the reasoning behind them not being public before, but I think they should be, just like `std::os::ios` and `std::os::macos` are public.

Additionally, I've merged their source code, as it was otherwise just a bunch of unnecessary duplication.

Ultimately, I've done this PR to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings.

Since you reviewed rust-lang/rust#121419
r? davidtwco

Fixes rust-lang/rust#121640.

`@rustbot` label O-tvos O-watchos O-visionos
lnicola pushed a commit to lnicola/rust-analyzer that referenced this issue Nov 28, 2024
Make `std::os::darwin` public

I'm not sure of the reasoning behind them not being public before, but I think they should be, just like `std::os::ios` and `std::os::macos` are public.

Additionally, I've merged their source code, as it was otherwise just a bunch of unnecessary duplication.

Ultimately, I've done this PR to fix `./x build library --target=aarch64-apple-tvos,aarch64-apple-watchos,aarch64-apple-visionos`, as that currently fails because of dead code warnings.

Since you reviewed rust-lang/rust#121419
r? davidtwco

Fixes rust-lang/rust#121640.

`@rustbot` label O-tvos O-watchos O-visionos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-tvos Operating system: tvOS (including simulator) T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
4 participants