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

Warn about metadata loader errors #53470

Merged
merged 1 commit into from
Sep 21, 2018
Merged

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Aug 18, 2018

Output when writing corrupting to libcore.rlib

warning: no metadata found: failed to read rlib metadata in '/Users/bjorn/Documents/rust_fork/build/x86_64-apple-darwin/stage1-std/x86_64-apple-darwin/release/deps/libcore-857d662d379c5d0c.rlib': File too small to be an archive

error[E0463]: can't find crate for `core`

error: aborting due to previous error

Fixes #53381

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 18, 2018
@eddyb
Copy link
Member

eddyb commented Aug 18, 2018

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned eddyb Aug 18, 2018
@alexcrichton
Copy link
Member

Hm so in my mind with compiler warnings there should be something actionable to make it go away, but in this case it may not be much that the user can do? I feel like we've added this sort of error handling in the past because it came up in real-world situations, although I don't remember precisely! I think it had something to do with parallel builds though in that rustc was trying to read half-written archives, which I believe should be safely (and silently) ignored, right?

@bjorn3
Copy link
Member Author

bjorn3 commented Aug 19, 2018

You can still ignore it using this PR, but this makes it easier to find out what's going on when having a bug in your own MetadataLoader, or mixing up -Zcodegen-backend=llvm and -Zcodegen-backend=metadata-only (like I think I got when trying to fix -Zcodegen-backend=metadata-only for partially bootstrapping rustc).

@alexcrichton
Copy link
Member

Could this be gated somehow in that case? I'm worried about this printing warnings for normal Cargo compiles and users can't do anything to squelch the warnings.

@bjorn3
Copy link
Member Author

bjorn3 commented Aug 21, 2018

How should I gate it? Add a -Z flag, add a env var, ...

@alexcrichton
Copy link
Member

A -Z flag seems reasonable to me!

@pietroalbini pietroalbini added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 27, 2018
@TimNN
Copy link
Contributor

TimNN commented Sep 4, 2018

Ping from triage @bjorn3: Some changes have been requested to your PR, do you think you'll be able to work on those?

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 4, 2018

Yes, I hope to do it tomorrow, if I dont forget that I opened this pr again.

@BatmanAoD
Copy link
Member

Ping from triage, @bjorn3 !

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 11, 2018

I have turned the info! into a warn!, instead of adding a -Z flag, because it is simpler and also easy to enable (RUST_LOG=warn).

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:13:16]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:13:16]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:13:17]    Compiling rustc_allocator v0.0.0 (file:///checkout/src/librustc_allocator)
[00:15:04]    Compiling rustc_traits v0.0.0 (file:///checkout/src/librustc_traits)
[00:16:35] error: incorrect close delimiter: `)`
[00:16:35]    --> librustc_metadata/locator.rs:620:60
[00:16:35]     |
[00:16:35] 620 |                         warn!("no metadata found: {}", err));
[00:16:35]     |
[00:16:35] note: unclosed delimiter
[00:16:35]    --> librustc_metadata/locator.rs:619:33
[00:16:35]     |
[00:16:35]     |
[00:16:35] 619 |                     Err(err) => {
[00:16:35] 
[00:16:35] 
[00:16:35] error: unexpected close delimiter: `}`
[00:16:35]    --> librustc_metadata/locator.rs:838:1
[00:16:35] 838 | }
[00:16:35]     | ^
[00:16:35] 
[00:16:35] error: aborting due to 2 previous errors
[00:16:35] error: aborting due to 2 previous errors
[00:16:35] 
[00:16:35] error: Could not compile `rustc_metadata`.
[00:16:35] 
[00:16:35] Caused by:
[00:16:35]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_metadata librustc_metadata/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=915a4098329d68e9 -C extra-filename=-915a4098329d68e9 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern flate2=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libflate2-29fe21234b9fb4ff.rlib --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-c55d6c95192e4906.rlib --extern proc_macro=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libproc_macro-87919c9c23cf3652.so --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-09c0f3a89ad0d6b5.so --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-05301c67193a930e.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-f4ac364f854372fe.so --extern rustc_metadata_utils=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_metadata_utils-9642bdbb3d859645.so --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-4a08b81d2b6640c1.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-8d84add221c0f710.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-8d84add221c0f710.rlib --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-0651ffc5a9129db1.so --extern syntax_ext=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_ext-d61f6c79c13e0eda.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-47b99ffec2efbd05.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-52504d5ed57fefc2/out -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-ee16f6821aef40e9/out` (exit code: 1)
[00:16:40] error: build failed
[00:16:40] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:16:40] expected success, got: exit code: 101
[00:16:40] expected success, got: exit code: 101
[00:16:40] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1155:9
[00:16:40] travis_fold:end:stage0-rustc

[00:16:40] travis_time:end:stage0-rustc:start=1536686740485535857,finish=1536687405847697596,duration=665362161739


[00:16:40] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:16:40] Build completed unsuccessfully in 0:12:00
[00:16:40] Makefile:28: recipe for target 'all' failed
[00:16:40] make: *** [all] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:05008752
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:03d108c1:start=1536687406685682288,finish=1536687406693322767,duration=7640479
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:008b501e
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1ce9cdb8
travis_time:start:1ce9cdb8
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:0539c946
$ dmesg | grep -i kill

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 15, 2018

Ready for review

@bjorn3
Copy link
Member Author

bjorn3 commented Sep 18, 2018

ping @alexcrichton

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Sep 18, 2018

📌 Commit de49681 has been approved by alexcrichton

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 18, 2018
@kennytm
Copy link
Member

kennytm commented Sep 18, 2018

@bors rollup

kennytm added a commit to kennytm/rust that referenced this pull request Sep 20, 2018
…crichton

Warn about metadata loader errors

Output when writing corrupting to libcore.rlib

```
warning: no metadata found: failed to read rlib metadata in '/Users/bjorn/Documents/rust_fork/build/x86_64-apple-darwin/stage1-std/x86_64-apple-darwin/release/deps/libcore-857d662d379c5d0c.rlib': File too small to be an archive

error[E0463]: can't find crate for `core`

error: aborting due to previous error
```

Fixes rust-lang#53381
bors added a commit that referenced this pull request Sep 20, 2018
Rollup of 15 pull requests

Successful merges:

 - #52813 (Duration div mul extras)
 - #53470 (Warn about metadata loader errors)
 - #54233 (Remove LLVM 3.9 workaround.)
 - #54257 (Switch wasm math symbols to their original names)
 - #54258 (Enable fatal warnings for the wasm32 linker)
 - #54266 (Update LLVM to fix "bool" arguments on PPC32)
 - #54290 (Switch linker for aarch64-pc-windows-msvc from LLD to MSVC)
 - #54292 (Suggest array indexing when tuple indexing on an array)
 - #54295 (A few cleanups and minor improvements to rustc/traits)
 - #54298 (miri: correctly compute expected alignment for field)
 - #54333 (Update The Book to latest)
 - #54337 (Remove unneeded clone() from tests in librustdoc)
 - #54346 (rustc: future-proof error reporting for polymorphic constants in types.)
 - #54362 (Pass --batch to gdb)
 - #54367 (Add regression test for thread local static mut borrows)
@bors bors merged commit de49681 into rust-lang:master Sep 21, 2018
@bjorn3 bjorn3 deleted the warn_metadata_errors branch September 21, 2018 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants