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

cfg_attr bootstrap does not work correctly when cross-compiling #84057

Closed
infinity0 opened this issue Apr 10, 2021 · 5 comments
Closed

cfg_attr bootstrap does not work correctly when cross-compiling #84057

infinity0 opened this issue Apr 10, 2021 · 5 comments
Labels
C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@infinity0
Copy link
Contributor

infinity0 commented Apr 10, 2021

https://buildd.debian.org/status/fetch.php?pkg=rustc&arch=amd64&ver=1.50.0%2Bdfsg1-1%7Eexp2&stamp=1618053860&raw=0 (warning, very large several MB)

This build uses 1.50.0 x86-64 linux as stage0 (bootstrap) to compile 1.50.0 again for both x86-64 linux and windows. The windows part of the build fails with:

    < Libdir { compiler: Compiler { stage: 2, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-pc-windows-gnu", file: None } }
running: "/usr/bin/rustc" "--cfg" "bootstrap" "--target" "x86_64-pc-windows-gnu" "--emit=obj" "-o" "/<<PKGBUILDDIR>>/build/x86_64-pc-windows-gnu/native/rtstartup/rsbegin.o" "/<<PKGBUILDDIR>>/library/rtstartup/rsbegin.rs"
error[E0557]: feature has been removed
  --> /<<PKGBUILDDIR>>/library/rtstartup/rsbegin.rs:17:32
   |
17 | #![cfg_attr(bootstrap, feature(optin_builtin_traits))]
   |                                ^^^^^^^^^^^^^^^^^^^^ feature has been removed
   |
   = note: renamed to `auto_traits`

error[E0658]: auto traits are experimental and possibly buggy
  --> /<<PKGBUILDDIR>>/library/rtstartup/rsbegin.rs:26:1
   |
26 | auto trait Sync {}
   | ^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
   = help: add `#![feature(auto_traits)]` to the crate attributes to enable

error[E0658]: auto traits are experimental and possibly buggy
  --> /<<PKGBUILDDIR>>/library/rtstartup/rsbegin.rs:30:1
   |
30 | auto trait Freeze {}
   | ^^^^^^^^^^^^^^^^^^^^
   |
   = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information
   = help: add `#![feature(auto_traits)]` to the crate attributes to enable

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0557, E0658.
For more information about an error, try `rustc --explain E0557`.

This suggests that cfg_attr(bootstrap is not activating correctly, probably being confused by the cross-compilation.

@infinity0 infinity0 added the C-bug Category: This is a bug. label Apr 10, 2021
@infinity0
Copy link
Contributor Author

CC @Mark-Simulacrum seems related to #61494

@Mark-Simulacrum
Copy link
Member

That pull request seems much older than should be relevant.

It also looks like it is activating, I think? But the same-version bootstrap isn't being detected; we shouldn't be passing cfg bootstrap in that case.

@Mark-Simulacrum
Copy link
Member

https://github.com/rust-lang/rust/blob/1.50.0/src/bootstrap/compile.rs#L423 should be checking if the initial_rustc is a "local rebuild" compiler before passing cfg=bootstrap, which can be done with a condition like https://github.com/rust-lang/rust/blob/1.50.0/src/bootstrap/builder.rs#L851 (just without the stage = 0, we're always stage 0 there)

@Mark-Simulacrum Mark-Simulacrum added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Apr 10, 2021
@Rustin170506
Copy link
Member

@rustbot claim

I willing work on this.

@jyn514 jyn514 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Apr 10, 2021
@infinity0
Copy link
Contributor Author

@Mark-Simulacrum thanks for the hint, seems straightforward - filed #84095

@hi-rustin thanks for the offer but I needed this quickly so I've just gone ahead and done it :)

@Rustin170506 Rustin170506 removed their assignment Apr 11, 2021
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 12, 2021
bootstrap: check local_rebuild before adding --cfg=bootstrap, closes rust-lang#84057
@bors bors closed this as completed in be5d721 Apr 12, 2021
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. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

4 participants