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

Running compile-fail tests after changing code results in "found crate std compiled by an incompatible version of rustc" #39751

Closed
shepmaster opened this issue Feb 11, 2017 · 10 comments
Labels
T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@shepmaster
Copy link
Member

I was trying to follow a TDD-like process:

  1. python ../x.py test ../src/test/compile-fail/ - note that only my test is failing, as expected
  2. Make changes to src/librustc_typeck/check/mod.rs to address the failure
  3. python ../x.py test ../src/test/compile-fail/ - all tests fail

The error from one of the tests:

------------------------------------------
error[E0514]: found crate `std` compiled by an incompatible version of rustc
  |
  = help: please recompile that crate using this compiler (rustc 1.17.0-dev (bf431b0f5 2017-02-10))
  = note: crate `std` path #1: /Users/shep/Projects/rust/build-release/build/x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib/libstd_unicode-5f2b70390d6f06f4.rlib compiled by "rustc 1.17.0-dev (435bb1c45 2017-02-10)"
  = note: crate `std` path #2: /Users/shep/Projects/rust/build-release/build/x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib/libstd_shim-6945dd0664fb6a35.rlib compiled by "rustc 1.17.0-dev (435bb1c45 2017-02-10)"
  = note: crate `std` path #3: /Users/shep/Projects/rust/build-release/build/x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib/libstd-6ce95fc10b65dc43.rlib compiled by "rustc 1.17.0-dev (435bb1c45 2017-02-10)"
  = note: crate `std` path #4: /Users/shep/Projects/rust/build-release/build/x86_64-apple-darwin/stage2/lib/rustlib/x86_64-apple-darwin/lib/libstd-6ce95fc10b65dc43.dylib compiled by "rustc 1.17.0-dev (435bb1c45 2017-02-10)"

error: aborting due to previous error

The build script says that the build is complete:

$ python ../x.py build
    Finished debug [unoptimized] target(s) in 0.0 secs
Synchronizing submodule url for 'src/compiler-rt'
Synchronizing submodule url for 'src/jemalloc'
Synchronizing submodule url for 'src/liblibc'
Synchronizing submodule url for 'src/llvm'
Synchronizing submodule url for 'src/rt/hoedown'
Synchronizing submodule url for 'src/rust-installer'
HEAD is now at d30da544 Merge pull request #30 from japaric/msan
HEAD is now at 11bfb0d Merge pull request #16 from glandium/rust
HEAD is now at 8d8264b96 Auto merge of #512 - dumbbell:support-aarch64-unknown-freebsd, r=alexcrichton
HEAD is now at ceb177eeefa Merge pull request #60 from japaric/gh38406
HEAD is now at da282f1 Merge pull request #8 from GuillaumeGomez/line_information
HEAD is now at 4f99485 Merge pull request #54 from brson/docdir
Building stage0 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage0 std from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage0 test artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage0 test from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage0 compiler artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage0 rustc from stage0 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Copying stage1 compiler (x86_64-apple-darwin)
Building stage1 std artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage1 std from stage1 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage1 test artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage1 test from stage1 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Building stage1 compiler artifacts (x86_64-apple-darwin -> x86_64-apple-darwin)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage1 rustc from stage1 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Copying stage2 compiler (x86_64-apple-darwin)
Copying stage2 std from stage1 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Copying stage2 test from stage1 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Copying stage2 rustc from stage1 (x86_64-apple-darwin -> x86_64-apple-darwin / x86_64-apple-darwin)
Build completed in 0:00:03

This is using 2425b22.

@keeperofdakeys
Copy link
Contributor

I've had the same issues a few times myself.

@alexcrichton
Copy link
Member

I believe this is a dupe of #39396, so closing in favor of that.

@alexcrichton
Copy link
Member

@shepmaster oh this may actually be a preexisting bug in the build system.

If you make a commit while you're working then the artifacts can get mixed up because the version has the git rev in it.

@shepmaster
Copy link
Member Author

I forget if I made a commit or not. It's possible I might have, under the impression that changing the HEAD commit would force a rebuild of the appropriate tools.

@alexcrichton
Copy link
Member

Yeah changing the head commit is something we don't check for right now but probably should! It looks like though that this is separate from #39396 so I'm gonna reopen.

@alexcrichton alexcrichton reopened this Feb 13, 2017
@alexcrichton alexcrichton added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 13, 2017
@nikomatsakis
Copy link
Contributor

Is there a workaround for this? I've just done ./x.py clean but ... that takes a while!

@alexcrichton
Copy link
Member

@nikomatsakis

rm -rf build/*/stage0-tools

That should just recompile compiletest

@xiongmao86
Copy link
Contributor

rm -rf build/*/stage0-std works for me.

@RalfJung
Copy link
Member

touch src/librustc_metadata/lib.rs is another work-around suggested by @arielb1 that works well for me.

@Mark-Simulacrum
Copy link
Member

This should be fixed by #43421, which will recompile the necessary crates based on their environment dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

7 participants