Skip to content

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

Closed

Description

@infinity0

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.

Activity

  1. infinity0 commented on Apr 10, 2021

    @infinity0
    ContributorAuthor

    CC @Mark-Simulacrum seems related to #61494

  2. Mark-Simulacrum commented on Apr 10, 2021

    @Mark-Simulacrum
    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.

  3. Mark-Simulacrum commented on Apr 10, 2021

    @Mark-Simulacrum
    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)

  4. added
    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
    E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
    on Apr 10, 2021
  5. 0xPoe commented on Apr 10, 2021

    @0xPoe
    Member

    @rustbot claim

    I willing work on this.

  6. added
    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
    on Apr 10, 2021
  7. infinity0 commented on Apr 11, 2021

    @infinity0
    ContributorAuthor

    @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 :)

  8. removed their assignment
    on Apr 11, 2021
  9. added a commit that references this issue on Apr 12, 2021
    67e402f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions