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

cargo-miri: ensure all rustc invocations go via our wrapper #3422

Closed
3 tasks
RalfJung opened this issue Mar 26, 2024 · 4 comments
Closed
3 tasks

cargo-miri: ensure all rustc invocations go via our wrapper #3422

RalfJung opened this issue Mar 26, 2024 · 4 comments

Comments

@RalfJung
Copy link
Member

RalfJung commented Mar 26, 2024

If we would set RUSTC to something like /cargo-miri-phase-rustc/if-you-see-this-some-build-script-forgot-to-apply-the-rustc-wrapper, then it would be blindingly obvious if anything ever bypassed our RUSTC_WRAPPER and called rustc directly. This kind of bypass is something we don't want to happen as then we can't carefully adjust the command-line flags to make everything work with Miri.

Unfortunately, this is currently blocked:

@RalfJung
Copy link
Member Author

rust-lang/cargo#10885 has a proposed fix at rust-lang/cargo#13659, but that needs testing to ensure that this doesn't break various ways of using cargo. Help wanted, in particular if you have experience with sccache :)

@RalfJung
Copy link
Member Author

FWIW the eyre issue is not necessarily a blocker; eyre will simply fail to build the probe and then disable both backtrace and track_caller, but other than that things will still work.

@RalfJung
Copy link
Member Author

RalfJung commented Mar 29, 2024

Turns out there's a huge amount of build scripts out there that invoke RUSTC without caring about RUSTC_WRAPPER. So it's likely people will run into a bunch of build failures if Miri decides to enforce the use of the wrapper.

We can either see this as a chance to push the ecosystem towards respecting the wrapper, or as an argument against setting RUSTC to a non-existent path...

A backup plan may be to keep setting RUSTC to the miri binary and set MIRI_BE_RUSTC to host. That is at least coherent in the sense that the default sysroot of the binary will also be a host sysroot. This will work fine as long as all these scripts do is query the version number. Build probes will fail in cross-target interpretation. It seems fine to me to say that this is a bug in the respective build probe, Miri's cross-target interpretation requires the wrapper to be used.
(That's what #3411 already does.)

bors added a commit to rust-lang/cargo that referenced this issue Apr 15, 2024
Make sure to also wrap the initial `-vV` invocation

Fixes #10885 and therefore helps unblock rust-lang/miri#3422.

This ensures that the version info actually matches the compiler that will later be doing the builds.
@RalfJung
Copy link
Member Author

RalfJung commented May 3, 2024

A backup plan may be to keep setting RUSTC to the miri binary and set MIRI_BE_RUSTC to host.

That's what we are doing now, and it seems to be the best we can do.

@RalfJung RalfJung closed this as completed May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant