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 has problems with spaces in sysroot #705

Closed
fschutt opened this issue Apr 20, 2019 · 3 comments · Fixed by #2175
Closed

cargo-miri has problems with spaces in sysroot #705

fschutt opened this issue Apr 20, 2019 · 3 comments · Fixed by #2175
Labels
A-cargo Area: affects the cargo wrapper (cargo miri) C-bug Category: This is a bug.

Comments

@fschutt
Copy link
Contributor

fschutt commented Apr 20, 2019

I've installed miri via rustup add component miri

rustc 1.36.0-nightly (8aaae4294 2019-04-19)
binary: rustc
commit-hash: 8aaae4294b16b8070a52b858364f440873bfc95c
commit-date: 2019-04-19
host: x86_64-pc-windows-msvc
release: 1.36.0-nightly
LLVM version: 8.0

When trying to run a hello world crate via miri, I get the following output:

$ cargo miri
It seems you do not have a recent enough xargo installed. I will run `cargo install xargo -f`. Proceed? [Y/n] Y
    Updating crates.io index
  Downloaded xargo v0.3.13
  Downloaded 1 crates (186.6 KB) in 0.77s
  Installing xargo v0.3.13
  Downloaded rustc_version v0.1.7
  Downloaded rand v0.4.6
  Downloaded semver v0.1.20
  Downloaded serde_json v0.8.6
  Downloaded error-chain v0.7.2
  Downloaded itoa v0.1.1
  Downloaded dtoa v0.2.2
   Compiling winapi-build v0.1.1
   Compiling winapi v0.3.7
   Compiling autocfg v0.1.2
   Compiling num-traits v0.2.6
   Compiling winapi v0.2.8
   Compiling rustc-demangle v0.1.14
   Compiling cfg-if v0.1.7
   Compiling libc v0.2.51
   Compiling xargo v0.3.13
   Compiling itoa v0.1.1
   Compiling rustc-serialize v0.3.24
   Compiling dtoa v0.2.2
   Compiling semver v0.1.20
   Compiling serde v0.8.23
   Compiling kernel32-sys v0.2.2
   Compiling backtrace v0.3.15
   Compiling rustc_version v0.1.7
   Compiling num-traits v0.1.43
   Compiling serde_json v0.8.6
   Compiling toml v0.2.1
   Compiling rand v0.4.6
   Compiling remove_dir_all v0.5.1
   Compiling fs2 v0.4.3
   Compiling dirs v1.0.5
   Compiling error-chain v0.7.2
   Compiling tempdir v0.3.7
   Compiling same-file v0.1.3
   Compiling walkdir v1.0.7
    Finished release [optimized] target(s) in 47.60s
  Installing C:\Users\Felix Schütt\.cargo\bin\xargo.exe
   Installed package `xargo v0.3.13` (executable `xargo.exe`)
It seems you do not have the rust-src component installed. I will run `rustup component add rust-src`. Proceed? [Y/n] Y
info: downloading component 'rust-src'
info: installing component 'rust-src'
    Updating crates.io index
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'C:\Users\Felix' 'Schütt\AppData\Local\miri\miri\cache\HOST' -Z force-unstable-if-unmarked --target x86_64-pc-windows-msvc --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro` (exit code: 1)
--- stderr
error: multiple input filenames provided (first two filenames are `-` and `Schütt\AppData\Local\miri\miri\cache\HOST`)


error: `"cargo" "build" "--release" "--manifest-path" "C:\\Users\\FELIXS~1\\AppData\\Local\\Temp\\xargo.NZRWjaHsFAad\\Cargo.toml" "--target" "x86_64-pc-windows-msvc" "-p" "std"` failed with exit code: Some(101)
note: run with `RUST_BACKTRACE=1` for a backtrace
fatal error: Failed to run xargo
$ RUST_BACKTRACE=1 cargo miri
    Updating crates.io index
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'C:\Users\Felix' 'Schütt\AppData\Local\miri\miri\cache\HOST' -Z force-unstable-if-unmarked --target x86_64-pc-windows-msvc --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro` (exit code: 1)
--- stderr
error: multiple input filenames provided (first two filenames are `-` and `Schütt\AppData\Local\miri\miri\cache\HOST`)


error: `"cargo" "build" "--release" "--manifest-path" "C:\\Users\\FELIXS~1\\AppData\\Local\\Temp\\xargo.c7N5WMu814CD\\Cargo.toml" "--target" "x86_64-pc-windows-msvc" "-p" "std"` failed with exit code: Some(101)
stack backtrace:
   0: <no info> (0x7ff668d2af52)
   1: <no info> (0x7ff668d2aff3)
   2: <no info> (0x7ff668cf78b7)
   3: <no info> (0x7ff668cec354)
   4: <no info> (0x7ff668cf1e5f)
   5: <no info> (0x7ff668cdc1fa)
   6: <no info> (0x7ff668cf8746)
   7: <no info> (0x7ff668d47b77)
   8: <no info> (0x7ff668d532b2)
   9: <no info> (0x7ff668d48422)
  10: <no info> (0x7ff668cdd2a7)
  11: <no info> (0x7ff668d62678)
  12: BaseThreadInitThunk (0x7fffb15413d2)
fatal error: Failed to run xargo

It seems that either xargo or miri is handling the sysroot wrong and splits the sysroot by spaces, so it doesn't find the sysroot if the path contains spaces:

--sysroot 'C:\Users\Felix' 'Schütt\AppData\Local\miri\miri\cache\HOST'

should be a single argument:

--sysroot 'C:\Users\Felix Schütt\AppData\Local\miri\miri\cache\HOST'
@RalfJung RalfJung added the C-bug Category: This is a bug. label Apr 20, 2019
@RalfJung
Copy link
Member

Interesting. I can reproduce this locally without Miri being involved -- the issue is in xargo or further upstream:

$ XARGO_HOME=~/.cache/"mi ri" XARGO_RUST_SRC=~/"src/rust/rustc/src" xargo build -v
+ "rustc" "--print" "sysroot"
+ RUSTFLAGS="--sysroot /home/r/.cache/mi ri/HOST -Z force-unstable-if-unmarked"
+ "cargo" "build" "--release" "--manifest-path" "/tmp/xargo.BGZjgFbURhmN/Cargo.toml" "--target" "x86_64-unknown-linux-gnu" "-v" "-p" "std"
    Updating crates.io index
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --sysroot /home/r/.cache/mi ri/HOST -Z force-unstable-if-unmarked --target x86_64-unknown-linux-gnu --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro` (exit code: 1)
--- stderr
error: multiple input filenames provided (first two filenames are `-` and `ri/HOST`)

Actually, it's a cargo issue: rust-lang/cargo#6139

@RalfJung
Copy link
Member

Also see this xargo issue: japaric/xargo#206

@RalfJung RalfJung added the A-cargo Area: affects the cargo wrapper (cargo miri) label Apr 26, 2019
bors bot added a commit to rust-analyzer/rowan that referenced this issue Jul 30, 2021
109: Use some ptr::addr_of_mut for taking ptr addr r=lnicola a=CAD97

Relevant to #108, but I'm not certain if it addresses the miri failure or not. (Can't check because of rust-lang/miri#705.)

Either way, this is a positive change, as previously we were creating `&mut` to uninitialized memory locations.

Co-authored-by: Durham, Christopher <cdurham@smu.edu>
@RalfJung
Copy link
Member

The xargo issue got fixed by japaric/xargo#336.

Could someone who was affected by this problem try installing the most recent xargo (cargo install --git https://github.com/japaric/xargo) and see if that fixes Miri?

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

Successfully merging a pull request may close this issue.

2 participants