Again the old cant find std crate issue


#1

This sounds ridiculous but I had an old rust installation working and removed it to install rust 1.12 from the tarball. I untarred and did sudo ./install.sh just to find out it doesn’t work because it can’t find std when I do cargo build on a project, even though I can see /usr/local/lib/rustlib with, what I think is, std crate. I uninstalled and used rustup.sh instead to no avail. I added it to LD_LIBRARY_PATH to no avail and after each of these attempts started a new terminal to make sure it was not that but also to no avail. What’s the correct procedure to get this working? Rust book means a single curl command with rustup.sh to get it working but that can’t be all.

What magic am I missing?

Thanks,

Paulo


#2

It would be helpful if you could paste the output of cargo --verbose build, which cargo, which rustc, cargo --version and rustc --version to provide some more information exactly what commands are being run and what version they are.

Normally just the rustup.sh script should be sufficient, like the book says, so there’s probably something on your system left over from the old installation that’s causing problems; the output of the above commands should help narrow down what that might be.

Another alternative is to use rustup.rs, a new version of rustup that’s written in Rust, provides many more features like managing multiple versions at once, and installs everything in your home directory rather than system-wide. It’s still in beta, so it’s not yet the officially recommended way of installing Rust, but it likely will replace rustup.sh at some point.


#3

Thanks @lambda. Apologies for the lack of information. I found the problem. I will add more detail soon.


#4

I wrote the resolution to this issue here.