我最近从
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`
货物安装货物编辑失败,结果与上述相同,因此不限于一个特定包裹.
即使是一个简单的程序:
fn main() {
println!("Hello, world!");
}
在名为hello.rs的文件中,运行的rustc hello.rs无法编译;它给出了同样的错误:错误:无法找到’std’的箱子[E0463].
下载了一个名为rust-std-x86_64-unknown-linux-gnu的目录,我假设它是std crate.在尝试查找std crate时,如何指示rustc找到此目录?
最佳答案 以下内容适用于最简单的编译.
假设您将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更多积分
>您不应该以root身份编译代码.
>您可能必须重新登录或运行bash -l以通过生锈来设置环境.
(这里生锈了)