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

no mir for "std::rt::lang_start_internal" #706

Closed
fschutt opened this issue Apr 20, 2019 · 9 comments
Closed

no mir for "std::rt::lang_start_internal" #706

fschutt opened this issue Apr 20, 2019 · 9 comments
Labels
C-support Category: Not necessarily a bug, but someone asking for support

Comments

@fschutt
Copy link
Contributor

fschutt commented Apr 20, 2019

I'm currently trying (as a weekend project) to use miri as an embedded interpreter, so that I could hot-reload game scripts (and then use the real rust compiler in release mode, for performance): https://github.com/fschutt/miri-repl-test

So I take the src/game_script.rs file, fix it up like described in #511 and write the generated file to a autogen_{cache_id}.rs. However, I currently can't execute the code since I run into the following error that I don't know how to fix:

--------- evaluating code!!!
rustc args: rustc autogen_0.rs --sysroot C:\Users\Felix Schütt\.rustup/toolchains/nightly-2019-04-20-x86_64-pc-windows-msvc
error[E0080]: constant evaluation error: no mir for `std::rt::lang_start_internal`
   |
   = note: inside call to `std::rt::lang_start::<()>`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0080`.
thread 'main' panicked at 'run compiler panic!: ErrorReported', src\libcore\result.rs:999:5
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: rustc::ty::structural_impls::<impl rustc::ty::context::Lift for rustc::ty::adjustment::AutoBorrow>::lift_to_tcx
   4: std::panicking::rust_panic_with_hook
   5: std::panicking::begin_panic_fmt
   6: rust_begin_unwind
   7: core::panicking::panic_fmt
   8: core::result::unwrap_failed<rustc::util::common::ErrorReported>
             at /rustc/8aaae4294b16b8070a52b858364f440873bfc95c\src\libcore\macros.rs:18
   9: core::result::Result::expect<(),rustc::util::common::ErrorReported>
             at /rustc/8aaae4294b16b8070a52b858364f440873bfc95c\src\libcore\result.rs:827
  10: miri_repl_test::compiler::eval_code
             at <unknown>:85
  11: miri_repl_test::main
             at <unknown>:29
  12: std::rt::lang_start::{{closure}}<()>
             at /rustc/8aaae4294b16b8070a52b858364f440873bfc95c\src\libstd\rt.rs:64
  13: std::panicking::update_panic_count
  14: _rust_maybe_catch_panic
  15: std::rt::lang_start_internal
  16: std::rt::lang_start<()>
             at /rustc/8aaae4294b16b8070a52b858364f440873bfc95c\src\libstd\rt.rs:64
  17: main
  18: invoke_main
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  19: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
  20: BaseThreadInitThunk
  21: RtlUserThreadStart
query stack during panic:
end of query stack
error: process didn't exit successfully: `target\debug\miri-repl-test.exe` (exit code: 101)

Is there a workaround? Right now I just try to evaluate an empty main function:

// autogen_0.rs
fn main() {
	// let a: f32 = 5.0;
	//
	// println!("Game speed is: {}", a);
}

I also have a few other questions:

  1. Is it possible to redirect the stdout ouput to somewhere else and prevent rustc from printing to stdout? For example, I basically want to make a GUI-based REPL, so I want to take the error string and display it inside of the GUI, instead of using stdout.
  2. How would I go about passing values from / to the interpreted code? For example, in the main.rs I have a "MiriReturn", which is supposed to contain an f32 type (which I want to evaluate in the interpreted code). How could I pass Rust object into the interpreter and how could I get objects out of the interpreter? Maybe using pointers, i.e. prefixing the interpreted code with format!("let read_ptr: *const MiriReturn = {:x}", &miri_return_object); or something like this? Would be fairly hacky though, is there a better way?
@bjorn3
Copy link
Member

bjorn3 commented Apr 20, 2019

[...] --sysroot C:\Users\Felix Schütt.rustup/[...]

Unfortunately usernames with spaces in them are not supported at the moment. See #705

  1. Is it possible to redirect the stdout ouput to somewhere else and prevent rustc from printing to stdout? For example, I basically want to make a GUI-based REPL, so I want to take the error string and display it inside of the GUI, instead of using stdout.

If you use Command to run miri then you can use .output() to spawn the process instead of .status() or .spawn(). This will automatically capture stdout and stderr and return them as Output struct.

@fschutt
Copy link
Contributor Author

fschutt commented Apr 20, 2019

No, Command is useless because that would require the user to have miri installed as a binary. I want to use miri as a library inside of an existing library in order to hot-reload code more or less as a script - and wanted to know if rustc_driver has options to disable stdout. I am trying to embed miri as part of an existing application, not as a separate binary.

Unfortunately usernames with spaces in them are not supported at the moment. See #705

Yes they are, #705 (which was opened by me) is a problem with a build script with xargo, not miri. I might be wrong, but the sysroot works fine (without the sysroot I get runtime errors such as "no std crate found"). I suspect that std::rt::lang_start_internal tries to use const fn, which miri isn't able to evaluate, so it says "no mir available". But that is just my guess.

@bjorn3
Copy link
Member

bjorn3 commented Apr 20, 2019

You can set diagnostic_output for the Config passed to run_compiler to capture all warnings and errors.

@RalfJung RalfJung added the C-support Category: Not necessarily a bug, but someone asking for support label Apr 20, 2019
@RalfJung
Copy link
Member

I also have a few other questions:

Please keep those separate from the bugreport though. This thread is going to become a mess. :/

Your main problem is caused by not having a sysroot that was compiled the right way. See these not-yet-merged instructions for some more details, I hope that helps.

I'm currently trying (as a weekend project) to use miri as an embedded interpreter, so that I could hot-reload game scripts

Miri is really slow, so it might not be the best choice for this purpose -- it's not the kind of usecase it is designed for. But I'm very curious how this will work out. :)

You might want to pass -Zmiri-disable-validation to make it not-quite-so-slow.

@fschutt
Copy link
Contributor Author

fschutt commented Apr 20, 2019

Okay I copied the setup() function from the cargo-miri.rs and it actually seems to work, it only crashes when running xargo / when creating the cache dir, but not when installing it. I'll investigate some more tomorrow. It seems that something is wrong with the setup() function - whether the sysroot contains spaces doesn't seem to be the problem. It doesn't fail to build and install xargo, it only fails when creating the cache directory.

Also xargo complained that the [dependencies.std] should have a path = "..." key, maybe that's it.

@RalfJung
Copy link
Member

Also xargo complained that the [dependencies.std] should have a path = "..." key, maybe that's it.

If you mean this, that's normal:

warning: Patch `rustc-std-workspace-core v1.0.0 (/home/travis/build/RalfJung/miri-test-libstd/rust-src-patched/src/tools/rustc-std-workspace-core)` was not used in the crate graph.

@fschutt
Copy link
Contributor Author

fschutt commented Apr 21, 2019

I've gotten it so far that it build libstd, however xargo seems to crash after it has successfully built libstd, which is what I don't understand - it crashes with a can't find crate for "core" error when building unicode_width and term (?) - you can take a look at my modified setup() function here: https://github.com/fschutt/miri-repl-test/blob/6ea6de9e090bbf9f40c72d6edc1ec75d24b83939/src/main.rs#L134

I tried working around the spaces-in-sysroot issue following this comment - by creating a /.cargo/config file (however, I created it in the /target/miri folder, not in /toolchains/.../libstd, not sure if that makes a difference.

$ RUST_BACKTRACE=1 cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `target\debug\miri-repl-test.exe`
OK xargo 0.3.13 installed!
running xargo
command: "xargo" "build" "--verbose" "-q"
+ "rustc" "--print" "sysroot"
+ RUSTFLAGS="-Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot target/miri\\HOST -Z force-unstable-if-unmarked"
+ "cargo" "build" "--release" "--manifest-path" "C:\\Users\\FELIXS~1\\AppData\\Local\\Temp\\xargo.AfNtV384ndRa\\Cargo.toml" "--target" "x86_64-pc-windows-msvc" "-v" "-p" "std"
    Updating crates.io index
   Compiling cc v1.0.35
   Compiling core v0.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore)
   Compiling libc v0.2.51
   Compiling unwind v0.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libunwind)
     Running `rustc --crate-name cc 'C:\Users\Felix Schütt\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\cc-1.0.35\src\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=b214f65e76f92cee -C extra-filename=-b214f65e76f92cee --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --cap-lints allow`
     Running `rustc --edition=2018 --crate-name core 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=78e37476c759abf3 -C extra-filename=-78e37476c759abf3 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked`
     Running `rustc --crate-name build_script_build 'C:\Users\Felix Schütt\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\libc-0.2.51\build.rs' --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="align"' --cfg 'feature="rustc-dep-of-std"' --cfg 'feature="rustc-std-workspace-core"' -C metadata=2691899aa27075b7 -C extra-filename=-2691899aa27075b7 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\build\libc-2691899aa27075b7' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --cap-lints allow`
     Running `rustc --edition=2018 --crate-name build_script_build 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libunwind\build.rs' --color always --crate-type bin --emit=dep-info,link -C opt-level=3 -C metadata=e9b36c9da5176427 -C extra-filename=-e9b36c9da5176427 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\build\unwind-e9b36c9da5176427' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps'`
     Running `C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\build\libc-2691899aa27075b7\build-script-build`
   Compiling compiler_builtins v0.1.10
   Compiling std v0.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd)
     Running `rustc --crate-name build_script_build 'C:\Users\Felix Schütt\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\compiler_builtins-0.1.10\build.rs' --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="c"' --cfg 'feature="cc"' --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' -C metadata=933e58ffafc3089c -C extra-filename=-933e58ffafc3089c --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\build\compiler_builtins-933e58ffafc3089c' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'cc=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps\libcc-b214f65e76f92cee.rlib' --cap-lints allow`
     Running `rustc --edition=2018 --crate-name build_script_build 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd\build.rs' --color always --crate-type bin --emit=dep-info,link -C opt-level=3 --cfg 'feature="panic_unwind"' -C metadata=3631da3d3a51372b -C extra-filename=-3631da3d3a51372b --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\build\std-3631da3d3a51372b' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'cc=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps\libcc-b214f65e76f92cee.rlib'`
     Running `C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\build\compiler_builtins-933e58ffafc3089c\build-script-build`
     Running `C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\build\unwind-e9b36c9da5176427\build-script-build`
     Running `C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\build\std-3631da3d3a51372b\build-script-build`
   Compiling rustc-std-workspace-core v1.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\tools\rustc-std-workspace-core)
     Running `rustc --edition=2018 --crate-name rustc_std_workspace_core 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\tools\rustc-std-workspace-core\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=9b40b9de0b69b2ab -C extra-filename=-9b40b9de0b69b2ab --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcore-78e37476c759abf3.rlib' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked`
     Running `rustc --crate-name libc 'C:\Users\Felix Schütt\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\libc-0.2.51\src\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg 'feature="align"' --cfg 'feature="rustc-dep-of-std"' --cfg 'feature="rustc-std-workspace-core"' -C metadata=c199c3c5178432e2 -C extra-filename=-c199c3c5178432e2 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'rustc_std_workspace_core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\librustc_std_workspace_core-9b40b9de0b69b2ab.rlib' --cap-lints allow -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked --cfg libc_priv_mod_use --cfg libc_union --cfg libc_const_size_of --cfg libc_align --cfg libc_core_cvoid --cfg libc_packedN`
     Running `rustc --crate-name compiler_builtins 'C:\Users\Felix Schütt\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\compiler_builtins-0.1.10\src\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg 'feature="c"' --cfg 'feature="cc"' --cfg 'feature="compiler-builtins"' --cfg 'feature="core"' --cfg 'feature="default"' --cfg 'feature="rustc-dep-of-std"' -C metadata=bfd9495b5fce40f5 -C extra-filename=-bfd9495b5fce40f5 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\librustc_std_workspace_core-9b40b9de0b69b2ab.rlib' --cap-lints allow -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked -L 'native=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\build\compiler_builtins-8f6e0673eafa8a3c\out' --cfg use_c -l static=compiler-rt`
   Compiling alloc v0.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\liballoc)
   Compiling rustc-demangle v0.1.14
   Compiling panic_abort v0.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libpanic_abort)
     Running `rustc --edition=2018 --crate-name unwind 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libunwind\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=e6272bc51f130de5 -C extra-filename=-e6272bc51f130de5 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'compiler_builtins=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcompiler_builtins-bfd9495b5fce40f5.rlib' --extern 'core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcore-78e37476c759abf3.rlib' --extern 'libc=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\liblibc-c199c3c5178432e2.rlib' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked -L 'native=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\build\compiler_builtins-8f6e0673eafa8a3c\out'`
     Running `rustc --edition=2018 --crate-name alloc 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\liballoc\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=a92e9966db0dfe44 -C extra-filename=-a92e9966db0dfe44 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'compiler_builtins=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcompiler_builtins-bfd9495b5fce40f5.rlib' --extern 'core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcore-78e37476c759abf3.rlib' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked -L 'native=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\build\compiler_builtins-8f6e0673eafa8a3c\out'`
     Running `rustc --crate-name rustc_demangle 'C:\Users\Felix Schütt\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\rustc-demangle-0.1.14\src\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg 'feature="compiler_builtins"' --cfg 'feature="core"' --cfg 'feature="rustc-dep-of-std"' -C metadata=963e1cf61c674768 -C extra-filename=-963e1cf61c674768 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'compiler_builtins=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcompiler_builtins-bfd9495b5fce40f5.rlib' --extern 'core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\librustc_std_workspace_core-9b40b9de0b69b2ab.rlib' --cap-lints allow -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked -L 'native=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\build\compiler_builtins-8f6e0673eafa8a3c\out'`
     Running `rustc --edition=2018 --crate-name panic_abort 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libpanic_abort\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=3f2dce0643d4d87a -C extra-filename=-3f2dce0643d4d87a --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'compiler_builtins=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcompiler_builtins-bfd9495b5fce40f5.rlib' --extern 'core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcore-78e37476c759abf3.rlib' --extern 'libc=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\liblibc-c199c3c5178432e2.rlib' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked -L 'native=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\build\compiler_builtins-8f6e0673eafa8a3c\out'`
   Compiling panic_unwind v0.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libpanic_unwind)
     Running `rustc --edition=2018 --crate-name panic_unwind 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libpanic_unwind\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=70d274abd4fbd99b -C extra-filename=-70d274abd4fbd99b --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'alloc=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\liballoc-a92e9966db0dfe44.rlib' --extern 'compiler_builtins=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcompiler_builtins-bfd9495b5fce40f5.rlib' --extern 'core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcore-78e37476c759abf3.rlib' --extern 'libc=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\liblibc-c199c3c5178432e2.rlib' --extern 'unwind=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libunwind-e6272bc51f130de5.rlib' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked -L 'native=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\build\compiler_builtins-8f6e0673eafa8a3c\out'`
     Running `rustc --edition=2018 --crate-name std 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libstd\lib.rs' --color always --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=3 --cfg 'feature="panic_unwind"' -C metadata=8c8436ff1438ac2d --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\release\deps' --extern 'alloc=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\liballoc-a92e9966db0dfe44.rlib' --extern 'compiler_builtins=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcompiler_builtins-bfd9495b5fce40f5.rlib' --extern 'core=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libcore-78e37476c759abf3.rlib' --extern 'libc=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\liblibc-c199c3c5178432e2.rlib' --extern 'panic_abort=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libpanic_abort-3f2dce0643d4d87a.rlib' --extern 'panic_unwind=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libpanic_unwind-70d274abd4fbd99b.rlib' --extern 'rustc_demangle=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\librustc_demangle-963e1cf61c674768.rlib' --extern 'unwind=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\deps\libunwind-e6272bc51f130de5.rlib' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked -l advapi32 -l ws2_32 -l userenv -L 'native=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.AfNtV384ndRa\target\x86_64-pc-windows-msvc\release\build\compiler_builtins-8f6e0673eafa8a3c\out'`
    Finished release [optimized] target(s) in 57.81s
+ RUSTFLAGS="-Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot target/miri\\HOST -Z force-unstable-if-unmarked"
+ "cargo" "build" "--release" "--manifest-path" "C:\\Users\\FELIXS~1\\AppData\\Local\\Temp\\xargo.wzoaAT9PV68k\\Cargo.toml" "--target" "x86_64-pc-windows-msvc" "-v" "-p" "test"
    Updating crates.io index
warning: Patch `rustc-std-workspace-core v1.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\tools\rustc-std-workspace-core)` was not used in the crate graph.
Check that the patched package version and available features are compatible
with the dependency requirements. If the patch has a different version from
what is locked in the Cargo.lock file, run `cargo update` to use the new
version. This may also occur with an optional dependency that is not enabled.
   Compiling unicode-width v0.1.5
   Compiling term v0.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libterm)
   Compiling proc_macro v0.0.0 (C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libproc_macro)
     Running `rustc --crate-name unicode_width 'C:\Users\Felix Schütt\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\unicode-width-0.1.5\src\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg 'feature="default"' -C metadata=f1e5206e995c62c9 -C extra-filename=-f1e5206e995c62c9 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\release\deps' --cap-lints allow -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked`
     Running `rustc --edition=2018 --crate-name term 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libterm\lib.rs' --color always --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=3 -C metadata=f6aa7511f5d3cc90 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\release\deps' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked`
     Running `rustc --edition=2018 --crate-name proc_macro 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libproc_macro\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=c58a71407e9ef52b -C extra-filename=-c58a71407e9ef52b --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\release\deps' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked`
error[E0463]: can't find crate for `core`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`

error: Could not compile `unicode-width`.

Caused by:
  process didn't exit successfully: `rustc --crate-name unicode_width 'C:\Users\Felix Schütt\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\unicode-width-0.1.5\src\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 --cfg 'feature="default"' -C metadata=f1e5206e995c62c9 -C extra-filename=-f1e5206e995c62c9 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\release\deps' --cap-lints allow -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked` (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: Could not compile `term`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name term 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libterm\lib.rs' --color always --crate-type dylib --crate-type rlib --emit=dep-info,link -C prefer-dynamic -C opt-level=3 -C metadata=f6aa7511f5d3cc90 --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\release\deps' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked` (exit code: 1)
warning: build failed, waiting for other jobs to finish...
error: Could not compile `proc_macro`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name proc_macro 'C:\Users\Felix Schütt\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libproc_macro\lib.rs' --color always --crate-type lib --emit=dep-info,link -C opt-level=3 -C metadata=c58a71407e9ef52b -C extra-filename=-c58a71407e9ef52b --out-dir 'C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' --target x86_64-pc-windows-msvc -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\x86_64-pc-windows-msvc\release\deps' -L 'dependency=C:\Users\FELIXS~1\AppData\Local\Temp\xargo.wzoaAT9PV68k\target\release\deps' -Zalways-encode-mir -Zmir-emit-retag -Zmir-opt-level=0 --cfg=miri --sysroot 'target/miri\HOST' -Z force-unstable-if-unmarked` (exit code: 1)
error: `"cargo" "build" "--release" "--manifest-path" "C:\\Users\\FELIXS~1\\AppData\\Local\\Temp\\xargo.wzoaAT9PV68k\\Cargo.toml" "--target" "x86_64-pc-windows-msvc" "-v" "-p" "test"` failed with exit code: Some(101)
stack backtrace:
   0: <no info> (0x7ff6dc18af52)
   1: <no info> (0x7ff6dc18aff3)
   2: <no info> (0x7ff6dc1578b7)
   3: <no info> (0x7ff6dc14c354)
   4: <no info> (0x7ff6dc151e5f)
   5: <no info> (0x7ff6dc13c1fa)
   6: <no info> (0x7ff6dc158746)
   7: <no info> (0x7ff6dc1a7b77)
   8: <no info> (0x7ff6dc1b32b2)
   9: <no info> (0x7ff6dc1a8422)
  10: <no info> (0x7ff6dc13d2a7)
  11: <no info> (0x7ff6dc1c2678)
  12: BaseThreadInitThunk (0x7ff905b813d2)
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: FailedToRunXargo', src\libcore\result.rs:999:5
stack backtrace:
   0: std::sys_common::alloc::realloc_fallback
   1: std::panicking::take_hook
   2: std::panicking::take_hook
   3: std::panicking::rust_panic_with_hook
   4: std::panicking::begin_panic_fmt
   5: rust_begin_unwind
   6: core::panicking::panic_fmt
   7: core::result::unwrap_failed<miri_repl_test::setup::SetupError>
             at /rustc/8aaae4294b16b8070a52b858364f440873bfc95c\src\libcore\macros.rs:18
   8: core::result::Result<(), miri_repl_test::setup::SetupError>::unwrap<(),miri_repl_test::setup::SetupError>
             at /rustc/8aaae4294b16b8070a52b858364f440873bfc95c\src\libcore\result.rs:800
   9: miri_repl_test::main
             at <unknown>:24
  10: std::rt::lang_start::{{closure}}<()>
             at /rustc/8aaae4294b16b8070a52b858364f440873bfc95c\src\libstd\rt.rs:64
  11: std::panicking::update_panic_count
  12: _rust_maybe_catch_panic
  13: std::rt::lang_start_internal
  14: std::rt::lang_start<()>
             at /rustc/8aaae4294b16b8070a52b858364f440873bfc95c\src\libstd\rt.rs:64
  15: main
  16: invoke_main
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  17: __scrt_common_main_seh
             at f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283
  18: BaseThreadInitThunk
  19: RtlUserThreadStart
error: process didn't exit successfully: `target\debug\miri-repl-test.exe` (exit code: 101)

What I find weird is that it does say: Compiling std... Finished release [optimized] target(s) in 57.81s - which is what I want, libstd compiled. However, it crashes after that, i.e. after libstd has been compiled (and for some reason it can't find libcore, even though libcore was found just seconds earlier).

@RalfJung
Copy link
Member

RalfJung commented Apr 21, 2019

After building libstd, it builds libtest -- that's needed for cargo miri test. This is the step that fails.

I think this is still the sysroot issue. I think xargo will have to do the sysroot config thing or stuff might become weird. Could you try this in an environment where the space issue does not apply? Like, patch this to do everything in a path like C:\miri, that contains no spaces.

@RalfJung RalfJung changed the title no mir for "std::rt::lang_start_internal" cargo miri setup fails when there is a space in the sysroot directory Apr 26, 2019
@RalfJung RalfJung changed the title cargo miri setup fails when there is a space in the sysroot directory no mir for "std::rt::lang_start_internal" Apr 26, 2019
@RalfJung
Copy link
Member

I am going to close this issue as a duplicate of #705. If you can reproduce this problem in a directory without spaces in it, please let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-support Category: Not necessarily a bug, but someone asking for support
Projects
None yet
Development

No branches or pull requests

3 participants