Closed
Description
Command.env
not work after nightly-2021-07-05
or commit 8345538
(maybe).
Here is my test main.rs
:
use std::process::Command;
fn main() {
Command::new("gcc").env("PATH", "C:\\msys64\\mingw64\\bin").spawn().expect("gcc not found");
}
> rustup default stable-x86_64-pc-windows-gnu
info: using existing install for 'stable-x86_64-pc-windows-gnu'
info: default toolchain set to 'stable-x86_64-pc-windows-gnu'
stable-x86_64-pc-windows-gnu unchanged - rustc 1.54.0 (a178d0322 2021-07-26)
> rustc main.rs -o stable.exe
> stable.exe # gcc found !!
gcc.exe: fatal error: no input files
compilation terminated.
> rustup default nightly-2021-07-05-x86_64-pc-windows-gnu
info: using existing install for 'nightly-2021-07-05-x86_64-pc-windows-gnu'
info: default toolchain set to 'nightly-2021-07-05-x86_64-pc-windows-gnu'
nightly-2021-07-05-x86_64-pc-windows-gnu unchanged - rustc 1.55.0-nightly (b3d11f95c 2021-07-04)
> rustc main.rs -o nightly.exe
> nightly.exe # gcc not found !!
thread 'main' panicked at 'gcc not found: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }', main.rs:4:73
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This also affects rustc
search for linker after nightly-2021-07-05 (with link-self-contained=yes
or without mingw installed)
Run the rustc
in cargo's bin works fine, but run the rustc
in toolchain's bin show this:
error: linker `x86_64-w64-mingw32-gcc` not found