Rust does not work after upgrade msvc tool chain

Hi guys,
I'm using cargo in a msvc command line , I've upgrade the tool chain to a newer version few days ago, after that , cargo can't compile , from the command line I found cargo has passed the wrong -L flag to rustc , it looks like

Caused by:
  process didn't exit successfully: `rustc --crate-name main 
--edition=2018 src/main.rs 
--error-format=json 
--json=diagnostic-rendered-ansi 
--crate-type bin 
--emit=dep-info,link 
-C opt-level=3 
-C embed-bitcode=no 
-C metadata=00e64df514e6b2c9 
--out-dir D:\notes\Rust\proj\target\release\deps 
-L dependency=D:\notes\Rust\proj\target\release\deps 
-L "D:/EWDK/Program Files/Windows Kits/10/Lib/10.0.19041.0/um/x64" 
-L "D:/EWDK/Program Files/Windows Kits/10/Lib/10.0.19041.0/ucrt/x64"` (exit code: 1)

the last 2 -L is wrong .
I can confirm that I've never set such values in cargo rustflags configuration item. They are in fact the path to the old msvc tool chain. I can't figure out how cargo remember this old values. Maybe these values are cached some where? I've tried cargo clean and rebuild but in vain. Please help!

I know you said you haven't modified the rustflags Cargo option, but did you check for .cargo/config and .cargo/config.toml in all the places that Cargo searches for it?

If that's not the issue, maybe a rogue environment variable is to blame? I don't know how to dump the values of all environment variables on Windows, but that could be something to try.

Also make sure that cargo --version is what you expect it to be.

thanks for reply. I finally found that I've set the CARGO_HOME. The cargo configuration in this directory is not modified accordingly . Perfect ! Again , I'm not reading the doc carefully :rofl:

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.