Auto merge of #2806 - saethlin:better-install, r=RalfJung
Install binaries to the miri toolchain's sysroot The default install produces this behavior: ``` $ cargo +miri miri --version miri 0.1.0 (0ba1f4a0 2023-03-05) $ cargo +nightly miri --version miri 0.1.0 (0ba1f4a0 2023-03-05) ``` Which is not good. We've effectively erased the toolchain selection, and users may reasonably conclude that their rustup install is broken. After this change, we now get this: ``` $ cargo +miri miri --version miri 0.1.0 (0ba1f4a0 2023-03-05) $ cargo +nightly miri --version miri 0.1.0 (f63ccaf 2023-03-06) ``` Thanks `@jyn514` who all but wrote this for me.
This commit is contained in:
commit
3ad2fece14
8
src/tools/miri/.github/workflows/ci.yml
vendored
8
src/tools/miri/.github/workflows/ci.yml
vendored
@ -54,8 +54,8 @@ jobs:
|
||||
# contains package information of crates installed via `cargo install`.
|
||||
~/.cargo/.crates.toml
|
||||
~/.cargo/.crates2.json
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: ${{ runner.os }}-cargo
|
||||
key: ${{ runner.os }}-cargo-reset20230315-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: ${{ runner.os }}-cargo-reset20230315
|
||||
|
||||
- name: Install rustup-toolchain-install-master
|
||||
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
|
||||
@ -106,8 +106,8 @@ jobs:
|
||||
# contains package information of crates installed via `cargo install`.
|
||||
~/.cargo/.crates.toml
|
||||
~/.cargo/.crates2.json
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: ${{ runner.os }}-cargo
|
||||
key: ${{ runner.os }}-cargo-reset20230315-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: ${{ runner.os }}-cargo-reset20230315
|
||||
|
||||
- name: Install rustup-toolchain-install-master
|
||||
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
|
||||
|
@ -129,18 +129,15 @@ development version of Miri using
|
||||
./miri install
|
||||
```
|
||||
|
||||
and then you can use it as if it was installed by `rustup`. Make sure you use
|
||||
the same toolchain when calling `cargo miri` that you used when installing Miri!
|
||||
Usually this means you have to write `cargo +miri miri ...` to select the `miri`
|
||||
toolchain that was installed by `./miri toolchain`.
|
||||
and then you can use it as if it was installed by `rustup` as a component of the
|
||||
`miri` toolchain. Note that the `miri` and `cargo-miri` executables are placed
|
||||
in the `miri` toolchain's sysroot to prevent conflicts with other toolchains.
|
||||
The Miri binaries in the `cargo` bin directory (usually `~/.cargo/bin`) are managed by rustup.
|
||||
|
||||
There's a test for the cargo wrapper in the `test-cargo-miri` directory; run
|
||||
`./run-test.py` in there to execute it. Like `./miri test`, this respects the
|
||||
`MIRI_TEST_TARGET` environment variable to execute the test for another target.
|
||||
|
||||
Note that installing Miri like this will "take away" Miri management from `rustup`.
|
||||
If you want to later go back to a rustup-installed Miri, run `rustup update`.
|
||||
|
||||
### Using a modified standard library
|
||||
|
||||
Miri re-builds the standard library into a custom sysroot, so it is fairly easy
|
||||
|
@ -62,8 +62,8 @@ function run_tests {
|
||||
if [ "$HOST_TARGET" = x86_64-unknown-linux-gnu ]; then
|
||||
# These act up on Windows (`which miri` produces a filename that does not exist?!?),
|
||||
# so let's do this only on Linux. Also makes sure things work without these set.
|
||||
export RUSTC=$(which rustc)
|
||||
export MIRI=$(which miri)
|
||||
export RUSTC=$(which rustc) # Produces a warning unless we also set MIRI
|
||||
export MIRI=$(rustc +miri --print sysroot)/bin/miri
|
||||
fi
|
||||
mkdir -p .cargo
|
||||
echo 'build.rustc-wrapper = "thisdoesnotexist"' > .cargo/config.toml
|
||||
|
@ -6,8 +6,8 @@ USAGE=$(cat <<"EOF"
|
||||
./miri install <flags>:
|
||||
Installs the miri driver and cargo-miri. <flags> are passed to `cargo
|
||||
install`. Sets up the rpath such that the installed binary should work in any
|
||||
working directory. However, the rustup toolchain when invoking `cargo miri`
|
||||
needs to be the same one used for `./miri install`.
|
||||
working directory. Note that the binaries are placed in the `miri` toolchain
|
||||
sysroot, to prevent conflicts with other toolchains.
|
||||
|
||||
./miri build <flags>:
|
||||
Just build miri. <flags> are passed to `cargo build`.
|
||||
@ -281,8 +281,9 @@ find_sysroot() {
|
||||
case "$COMMAND" in
|
||||
install)
|
||||
# "--locked" to respect the Cargo.lock file if it exists.
|
||||
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked "$@"
|
||||
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked "$@"
|
||||
# Install binaries to the miri toolchain's sysroot so they do not interact with other toolchains.
|
||||
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR" --force --locked --root "$SYSROOT" "$@"
|
||||
$CARGO install $CARGO_EXTRA_FLAGS --path "$MIRIDIR"/cargo-miri --force --locked --root "$SYSROOT" "$@"
|
||||
;;
|
||||
check)
|
||||
# Check, and let caller control flags.
|
||||
|
Loading…
x
Reference in New Issue
Block a user