I am curently developing a Rust program on Windows 10. A few months ago I created a library package using cargo. Since then, I’ve been developing this program. Whenever I want to execute what I have, I goto to cmd and execute the following command inside my cargo folder:
cargo run --release --bin main
But, a few weeks ago something strange started to happen. Whenever I execute this same command, I notice that the program in fact starts but it finishes preemptively (I know this because of the output to the terminal). When the program finishes it is supposed to write to the terminal “FINISHED”. But this never happens. If I execute the command again (without changing the code), this time the only thing that’s printed to the terminal is the build message that cargo puts out. Then, when I execute a third time, I have the following message on my terminal:
error: 'cargo.exe' is not installed for the toolchain 'stable-x86_64-pc-windows-msvc' To install, run `rustup component add cargo --toolchain stable-x86_64-pc-windows-msvc`
Then if I execute the suggested command, I have the following:
component 'cargo' for target 'x86_64-pc-windows-msvc' was automatically added because it is required for toolchain 'stable-x86_64-pc-windows-msvc'
What’s weird is that if I execute the previous cargo run command on the Ubuntu terminal application that I have (it simulates a linux terminal, but I am still on my windows file system), this problem doesn’t occur. I can execute 100 or 1000 times and no problems. But this isn’t good, since my program creates a multi threaded environment and my Ubuntu terminal is like a virtual machine, so I don’t believe that I have access to all of my laptop’s memory.
Currently I have rustup 1.18.3 (435397f48 2019-05-22) on both windows and my ubuntu terminal.
What I have been doing until now to solve this is on my windows is to reboot my computer and reinstall rust, since when I execute “rustup self uninstall” sometimes an error of not having permissions to install it appears (I only have 1 user on my pc and supposedly I have admin privileges).
I have googled this situation, but I haven’t found anything regarding rustc disappearing when executing cargo run. Now I can’t even run my program on windows cmd, since this problem happens every time.