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

miri no longer builds after rust-lang/rust#73441 #74484

Closed
rust-highfive opened this issue Jul 18, 2020 · 11 comments · Fixed by #74561
Closed

miri no longer builds after rust-lang/rust#73441 #74484

rust-highfive opened this issue Jul 18, 2020 · 11 comments · Fixed by #74561
Assignees
Labels
A-miri Area: The miri tool C-bug Category: This is a bug.

Comments

@rust-highfive
Copy link
Collaborator

Hello, this is your friendly neighborhood mergebot.
After merging PR #73441, I observed that the tool miri has failing tests.
A follow-up PR to the repository https://github.com/rust-lang/miri is needed to fix the fallout.

cc @alexcrichton, do you think you would have time to do the follow-up work?
If so, that would be great!

And nominating for compiler team prioritization.

@rust-highfive rust-highfive added A-miri Area: The miri tool C-bug Category: This is a bug. labels Jul 18, 2020
@oli-obk
Copy link
Contributor

oli-obk commented Jul 19, 2020

I don't think we can resolve this until #74506 is fixed, as we can't build a libstd anymore :(

@RalfJung
Copy link
Member

RalfJung commented Jul 19, 2020

However, that cannot be the only problem -- Miri also fails to build in-tree:

2020-07-18T16:41:13.8191493Z error[E0432]: unresolved import `rustc_demangle`
2020-07-18T16:41:13.8192822Z   --> /checkout/src/libstd/../backtrace/src/symbolize/mod.rs:13:5
2020-07-18T16:41:13.8193112Z    |
2020-07-18T16:41:13.8193595Z 13 | use rustc_demangle::{try_demangle, Demangle};
2020-07-18T16:41:13.8193892Z    |     ^^^^^^^^^^^^^^ use of undeclared type or module `rustc_demangle`
2020-07-18T16:41:13.8197541Z 
2020-07-18T16:41:15.8938727Z error: aborting due to previous error

@alexcrichton any idea why those might be missing?

@RalfJung
Copy link
Member

rustc-demangle is an optional dependency of libstd, and Miri does not enable that option. Looks like the backtrace code incorrectly expects it to be present anyway?

@alexcrichton
Copy link
Member

Ah this is my mistake, I didn't check that libstd still compiled without the backtrace dependency. I believe that unconditionally depending on rustc-demangle is indeed the right thing to do. I can send a PR for this tomorrow if no one else gets to it.

@RalfJung
Copy link
Member

Just please make sure to also include it in rust-src then :)

alexcrichton added a commit to alexcrichton/rust that referenced this issue Jul 20, 2020
This should hopefully handle rust-lang#74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.
@alexcrichton
Copy link
Member

I'm hoping this will be fixed by #74540

Manishearth added a commit to Manishearth/rust that referenced this issue Jul 20, 2020
…rk-Simulacrum

std: Fix compilation without backtrace feature

This should hopefully handle rust-lang#74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 20, 2020
…-Simulacrum

std: Fix compilation without backtrace feature

This should hopefully handle rust-lang#74484 but in any case fixes compilation of
the standard library without the `backtrace` feature. The need for this
feature is somewhat unclear now because the `backtrace` crate should
always compile (no more C code!) but we can handle that later if
necessary.
@RalfJung
Copy link
Member

RalfJung commented Jul 20, 2020 via email

@RalfJung
Copy link
Member

That indeed solved the libstd build issue, at least for in-tree builds. Now the problem is

2020-07-20T06:48:53.8607834Z error: unsupported operation: can't call foreign function: _Unwind_Backtrace
2020-07-20T06:48:53.8608239Z   --> /checkout/src/libstd/../backtrace/src/backtrace/libunwind.rs:96:5
2020-07-20T06:48:53.8608410Z    |
2020-07-20T06:48:53.8608769Z 96 |     uw::_Unwind_Backtrace(trace_fn, &mut cb as *mut _ as *mut _);
2020-07-20T06:48:53.8609220Z    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't call foreign function: _Unwind_Backtrace

Previously, disabling the backtrace feature meant we did not have to do anything. Now it seems like some C FFI (_Unwind_Backtrace) is mandatory? That's odd though, elsewhere @alexcrichton said this is now Rust-only.

@RalfJung
Copy link
Member

Interestingly, _Unwind_Backtrace is only called on a double-panic.

@RalfJung
Copy link
Member

rust-lang/backtrace-rs#360 should help (and that's way easier than finding all the methods we have to stub, in particular on Windows).

@alexcrichton
Copy link
Member

Backtraces are unconditionally generated on double panics, and some reshuffling of the crate itself probably meant that #[cfg(miri)] happened to go to the noop unwinder before and now it went to the libunwind unwinder. In any case rust-lang/backtrace-rs#360 should fix that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-miri Area: The miri tool C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants