我最近从this site(Linux 64位)下载并解压缩了Rust语言。
然后我使用下载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.
我正在尝试安装带货物的箱子,但我一直遇到这个错误:
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。在尝试查找std crate时,如何指示rustc找到此目录?
答案 0 :(得分:1)
以下内容适用于最简单的编译。 假设您将tar文件解压缩,比如说
$HOME/rust-1.10.0-x86_64-unknown-linux-gnu
然后运行
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
但我确信克里斯摩根建议更好的办法是生锈。
Coupla更多积分
(同事们在这里生锈)