我最近从这个网站下载并解压了Rust语言(Linux 64位)。
然后,我使用下载的install.sh
脚本安装了Rust:
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.
我正在尝试使用cargo安装一个crate,但是一直遇到以下错误:
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
失败,结果和上面一样,因此这不仅限于一个特定的包。
即使是放置一个简单的程序:
fn main() {
println!("Hello, world!");
}
在名为
hello.rs
的文件中运行 rustc hello.rs
无法编译;它会给出相同的错误:error: can't find crate for 'std' [E0463]
。下载包含一个名为
rust-std-x86_64-unknown-linux-gnu
的目录,我认为这是 std crate。如何指示 rustc 在尝试查找 std crate 时找到此目录?
cargo install cargo-edit
。虽然Racer需要std的源代码,但错误消息听起来像是编译器找不到std的二进制文件,因此它甚至无法编译Racer。 - user395760rustc
不知道std
crate在哪里。 - Matthieu M.