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

thread 'rustc' panicked at 'failed to open bitcode file' #72006

Closed
AurevoirXavier opened this issue May 8, 2020 · 4 comments · Fixed by #72020
Closed

thread 'rustc' panicked at 'failed to open bitcode file' #72006

AurevoirXavier opened this issue May 8, 2020 · 4 comments · Fixed by #72020
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@AurevoirXavier
Copy link

AurevoirXavier commented May 8, 2020

thread 'rustc' panicked at 'failed to open bitcode file `/Users/xavier/Documents/program/darwinia-network/common/target/debug/wbuild/target/wasm32-unknown-unknown/release/incremental/darwinia_eth_relay-14z60xegabart/s-fn86imq5gn-oskx2p-working/2kbbxxydsp0pt75g.pre-lto.bc`: No such file or directory (os error 2)', /rustc/a08c47310c7d49cbdc5d7afb38408ba519967ecd/src/libstd/macros.rs:16:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.45.0-nightly (a08c47310 2020-05-07) running on x86_64-apple-darwin

note: compiler flags: -C opt-level=3 -C panic=abort -C linker-plugin-lto -C incremental -C link-arg=--export-table -C link-arg=--export=__heap_base -C link-arg=--import-memory --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: could not compile `darwinia-eth-relay`.

To learn more, run the command again with --verbose.

First compile is ok, after I modify some contents. It failed. I've to cargo clean. Then works.

@AurevoirXavier AurevoirXavier added the C-bug Category: This is a bug. label May 8, 2020
@AurevoirXavier
Copy link
Author

AurevoirXavier commented May 8, 2020

I don't know how to setup a minimal env to reproduce this. But I'd love to provide any info you needed.

@jonas-schievink jonas-schievink added A-incr-comp Area: Incremental compilation I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels May 8, 2020
@ehuss
Copy link
Contributor

ehuss commented May 8, 2020

cc @alexcrichton Is this maybe related to #71754? (Although this sounds like the opposite of that, where it is missing the bit code.)

@alexcrichton
Copy link
Member

Some digging shows that this is a preexisting bug in rustc:

$ touch foo.rs 
$ rustc +stable foo.rs -C incremental=inc -O --crate-type rlib -C linker-plugin-lto
$ rustc +stable foo.rs -C incremental=inc -O --crate-type rlib -C linker-plugin-lto
thread 'rustc' panicked at 'failed to open bitcode file `/home/alex/code/rust3/lol/inc/foo-2274d9nt8ooh9/s-fn8iukgg9j-10g2qx1-working/2yck3ogdpf9mjtsp.pre-lto.bc`: No such file or directory (os error 2)', <::std::macros::panic macros>:5:6
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.43.1 (8d69840ab 2020-05-04) running on x86_64-unknown-linux-gnu

note: compiler flags: -C incremental -C linker-plugin-lto -C save-temps --crate-type rlib

I believe that this is only showing up now because Cargo is only just now passing -Clinker-plugin-lto

@alexcrichton
Copy link
Member

I've posted a fix for this at #72020

alexcrichton added a commit to alexcrichton/rust that referenced this issue May 8, 2020
This commit fixes an issue where the codegen backend's selection of LTO
disagreed with what the codegen later thought was being done. Discovered
in rust-lang#72006 we have a longstanding issue where if `-Clinker-plugin-lto` in
optimized mode is compiled incrementally it will always panic on the
second compilation. The underlying issue turned out to be that the
production of the original artifact determined that LTO should not be
done (because it's being postponed to the linker) but the CGU reuse
selection thought that LTO was done so it was trying to load pre-LTO
artifacts which were never generated.

The fix here is to ensure that the logic when generating code which
determines what kind of LTO is being done is shared amongst the CGU
reuse decision and the backend actually doing LTO. This means that
they'll both be in agreement about whether the previous compilation did
indeed produce incremental pre-LTO artifacts.

Closes rust-lang#72006
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 9, 2020
…-plugin-lto, r=oli-obk

Fix disagreeement about CGU reuse and LTO

This commit fixes an issue where the codegen backend's selection of LTO
disagreed with what the codegen later thought was being done. Discovered
in rust-lang#72006 we have a longstanding issue where if `-Clinker-plugin-lto` in
optimized mode is compiled incrementally it will always panic on the
second compilation. The underlying issue turned out to be that the
production of the original artifact determined that LTO should not be
done (because it's being postponed to the linker) but the CGU reuse
selection thought that LTO was done so it was trying to load pre-LTO
artifacts which were never generated.

The fix here is to ensure that the logic when generating code which
determines what kind of LTO is being done is shared amongst the CGU
reuse decision and the backend actually doing LTO. This means that
they'll both be in agreement about whether the previous compilation did
indeed produce incremental pre-LTO artifacts.

Closes rust-lang#72006
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 9, 2020
…-plugin-lto, r=oli-obk

Fix disagreeement about CGU reuse and LTO

This commit fixes an issue where the codegen backend's selection of LTO
disagreed with what the codegen later thought was being done. Discovered
in rust-lang#72006 we have a longstanding issue where if `-Clinker-plugin-lto` in
optimized mode is compiled incrementally it will always panic on the
second compilation. The underlying issue turned out to be that the
production of the original artifact determined that LTO should not be
done (because it's being postponed to the linker) but the CGU reuse
selection thought that LTO was done so it was trying to load pre-LTO
artifacts which were never generated.

The fix here is to ensure that the logic when generating code which
determines what kind of LTO is being done is shared amongst the CGU
reuse decision and the backend actually doing LTO. This means that
they'll both be in agreement about whether the previous compilation did
indeed produce incremental pre-LTO artifacts.

Closes rust-lang#72006
bors added a commit to rust-lang-ci/rust that referenced this issue May 10, 2020
…lugin-lto, r=oli-obk

Fix disagreeement about CGU reuse and LTO

This commit fixes an issue where the codegen backend's selection of LTO
disagreed with what the codegen later thought was being done. Discovered
in rust-lang#72006 we have a longstanding issue where if `-Clinker-plugin-lto` in
optimized mode is compiled incrementally it will always panic on the
second compilation. The underlying issue turned out to be that the
production of the original artifact determined that LTO should not be
done (because it's being postponed to the linker) but the CGU reuse
selection thought that LTO was done so it was trying to load pre-LTO
artifacts which were never generated.

The fix here is to ensure that the logic when generating code which
determines what kind of LTO is being done is shared amongst the CGU
reuse decision and the backend actually doing LTO. This means that
they'll both be in agreement about whether the previous compilation did
indeed produce incremental pre-LTO artifacts.

Closes rust-lang#72006
@bors bors closed this as completed in c7bd5a6 May 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants