![Firefox 构建“你的路径中必须有‘rustc’”?](https://linux22.com/image/105107/Firefox%20%E6%9E%84%E5%BB%BA%E2%80%9C%E4%BD%A0%E7%9A%84%E8%B7%AF%E5%BE%84%E4%B8%AD%E5%BF%85%E9%A1%BB%E6%9C%89%E2%80%98rustc%E2%80%99%E2%80%9D%EF%BC%9F.png)
我正在尝试在 Mint 17 上从源代码构建 Firefox 51。
我已经运行了 boostrap 脚本并安装了 Rust,但./mach build
显然找不到它?
错误是:
0:03.58 checking for rustc... not found
0:03.58 checking for cargo... not found
0:03.58 ERROR: Rust compiler not found.
0:03.58 To compile rust language sources, you must have 'rustc' in your path.
0:03.58 See https//www.rust-lang.org/ for more information.
0:03.58
0:03.58 You can install rust by running './mach bootstrap'
0:03.58 or by directly running the installer from https://rustup.rs/
0:03.58
但我已经跑了./mach bootstrap
并且它安装了 Rust!
现在当我./mach bootstrap
再次跑步时,它说:
Could not find a Rust compiler.
You have some rust files in /home/user/.cargo/bin
but they're not part of this shell's PATH.
To add these to the PATH, edit your shell initialization
script, which may be called ~/.bashrc or ~/.bash_profile or
~/.profile, and add the following line:
source /home/user/.cargo/env
Then restart your shell and run the bootstrap script again.
所以我就这么做了。~/.profile
现在已经source /home/user/.cargo/env
在底部了。我重新启动了终端。而且./mach bootstrap
仍然./mach build
找不到铁锈。
我该如何解决?
答案1
由于source ~/.profile
引导脚本已经将 rustc 路径附加到我的~/.profile
.
如果路径附加到~/.bashrc
或~/.bash_profile
,source ~/.bashrc
或source ~/.bash_profile
分别应该完成这项工作。
如果脚本未将路径附加到任何文件,您可以自行将路径附加到三个文件中的任何一个(export PATH="$HOME/.cargo/bin:$PATH"
附加在 my 中~/.profile
)并执行source ~/.<respective file>
.
答案2
手动安装 Rust 似乎可以解决这个问题:
curl https://sh.rustup.rs -sSf | sh