Linux-Mint

Firefox 建構“你的路徑中必須有 ‘rustc’”?

  • March 6, 2017

我正在嘗試從 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找不到生鏽。

我該如何解決?

手動安裝 Rust 似乎解決了這個問題:

curl https://sh.rustup.rs -sSf | sh

因為引導source ~/.profile腳本已經在我的~/.profile.

如果路徑附加到~/.bashrcor ~/.bash_profilesource ~/.bashrcorsource ~/.bash_profile應該分別完成這項工作。

如果腳本未將路徑附加到任何文件,您可以自行將路徑附加到三個文件中的任何一個(export PATH="$HOME/.cargo/bin:$PATH"附加在 my 中~/.profile)並執行source ~/.<respective file>.

引用自:https://unix.stackexchange.com/questions/343662