I recently downloaded and unpacked the Rust Language from this site (Linux 64-bit).
I then installed Rust using the given script in the download install.sh
:
root@kali:~# /root/rust-1.9.0-x86_64-unknown-linux-gnu/install.sh
install: uninstalling component 'rustc'
install: creating uninstall script at /usr/local/lib/rustlib/uninstall.sh
install: installing component 'rustc'
install: installing component 'rust-std-x86_64-unknown-linux-gnu'
install: installing component 'rust-docs'
install: installing component 'cargo'
Rust is ready to roll.
I am trying to install a crate with cargo, but I keep running into this error:
root@kali:~# cargo install racer
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling winapi v0.2.7
Compiling bitflags v0.5.0
error: can't find crate for `std` [E0463]
error: aborting due to previous error
Build failed, waiting for other jobs to finish...
error: can't find crate for `std` [E0463]
error: aborting due to previous error
error: failed to compile `racer v1.2.10`, intermediate artifacts can be found at `/root/target-install`
cargo install cargo-edit
failed with the same result as above, so it's not limited to one particular package.
Even putting a simple program:
fn main() {
println!("Hello, world!");
}
in a file named hello.rs
and running rustc hello.rs
does not compile; it gives the same error: error: can't find crate for 'std' [E0463]
.
The download came with a directory named rust-std-x86_64-unknown-linux-gnu
, which I assume is the std crate. How do I instruct rustc to find this directory when trying to locate the std crate?
The following will work for the simplest of compilations. Assuming you extracted the tar file to, say
$HOME/rust-1.10.0-x86_64-unknown-linux-gnu
Then run
arch=x86_64-unknown-linux-gnu
dl=$HOME/rust-1.10.0-$arch
$dl/rustc/bin/rustc -L $dl/rustc/lib \
-L $dl/rust-std-$arch/lib/rustlib/$arch/lib \
hello.rs
But I'm sure a better way would be to run rustup as Chris Morgan suggest.
Coupla more points
(Fellow rust newb here)
For me (Arch Linux) removing system's Rust fixed the issue.
pacman -Rc rust
I think there was a conflict among user installed Rust and system installed one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With