Closed Bug 1319860 Opened 8 years ago Closed 8 years ago

mach bootstrap does not install rust on a fresh Mac

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox53 fixed)

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: armenzg, Assigned: rillian)

References

Details

Attachments

(1 file)

Could not find a Rust compiler.
Will try to install Rust.
Downloading rustup-init... Ok
Running rustup-init...
info: syncing channel updates for 'stable-x86_64-apple-darwin'
info: downloading component 'rustc'
 28.7 MiB /  28.7 MiB (100 %)   9.1 MiB/s ETA:   0 s
info: downloading component 'rust-std'
 36.1 MiB /  36.1 MiB (100 %)   5.0 MiB/s ETA:   0 s
info: downloading component 'rust-docs'
  7.5 MiB /   7.5 MiB (100 %)   5.1 MiB/s ETA:   0 s
info: downloading component 'cargo'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'rust-docs'
info: installing component 'cargo'
info: default toolchain set to 'stable'

  stable installed - rustc 1.13.0 (2c6933acc 2016-11-07)

Rust installation complete.
Could not find a Rust compiler.

We attempted to upgrade Rust to a modern version (1.13.0 or newer).
However, you appear to still have version None.

It's possible rustup failed. It's also possible the new Rust is not being
installed in the search path for this shell. Try creating a new shell and
run this bootstrapper again.

If this continues to fail and you are sure you have a modern Rust on your
system, ensure it is on the $PATH and try again. If that fails, you'll need to
install Rust manually and ensure the path with the rustc and cargo  binaries
are listed in the $PATH environment variable.

We recommend the installer from https://rustup.rs/ for installing Rust,
but you may be able to get a recent enough version from a software install
tool or package manager on your system, or directly from https://rust-lang.org/
rillian added this in bug 1286799. I'm assuming that the binaries wind up in ~/.cargo/bin or something like that and they're not in your $PATH? If that's the case we should just have the bootstrapper tell you to add that to your $PATH and not print an error about it.
Blocks: 1286799
bootstrap.py did give good instructions on fixing this:  .bashrc, .bashprofile (which worked for me) or .profile will have a place to modify $PATH.
I think the problem here is that we check again for a modern rust after running the compiler, but it's not going to be in path, and that's after we check for it not being in path and printing the helpful error message. I'll try to refactor a bit.
Assignee: nobody → giles
We check again after running the installer, I mean.
Attachment #8814273 - Flags: review?(nalexander)
Drive-by holiday in-person r=nalexander to get this landed before it affects more folks.
Comment on attachment 8814273 [details]
Bug 1319860 - mozboot: Prompt to add rust to PATH after install.

https://reviewboard.mozilla.org/r/95510/#review95748

r=nalexander in person.
Attachment #8814273 - Flags: review+
Pushed by rgiles@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0a2a927ff038
mozboot: Prompt to add rust to PATH after install. r=nalexander
Attachment #8814273 - Flags: review?(nalexander)
(In reply to Ralph Giles (:rillian) needinfo me from comment #6)
> Drive-by holiday in-person r=nalexander to get this landed before it affects
> more folks.

gps: I was in the office and Ralph walked me through this.  It was simple enough, so we had two sets of eyes before landing.
Status: NEW → ASSIGNED
Should mach automatically add ~/.cargo/bin (or is it "$CARGO_HOME/bin"?) to $PATH?
https://hg.mozilla.org/mozilla-central/rev/0a2a927ff038
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
(In reply to Simon Sapin (:SimonSapin) from comment #11)
> Should mach automatically add ~/.cargo/bin (or is it "$CARGO_HOME/bin"?) to
> $PATH?

Do we already have code to do this for the user? Seems tricky if there's already PATH manipulation in the startup files.

I don't think we should do this inside `mach build`. We rely on the environment for most executables, so this would make rust behave differently from other tools.

It would be good if the installer could do something. Rustup tries by writing out a `.profile` but I think most people use the overriding .bash_profile instead. If that could be improved to work in more cases, the installer could just recommend a `source ~/.cargo/env` locally as an alternative to restarting the shell.

On Windows, the MozillaBuildBootstrapper installs an entry in the msys etc/profile.d which seems to work. https://dxr.mozilla.org/mozilla-central/source/python/mozboot/mozboot/mozillabuild.py#35

However, that's not appropriate on Linux or Mac (where it's /etc/paths.d) because rustup installs a user-local toolchain rather than a system-wide one.
Flags: needinfo?(simon.sapin)
I don’t know what the needinfo is for specifically, but my previous comment was just a random suggestion in passing. I don’t know much about gecko’s mach.
Flags: needinfo?(simon.sapin)
Ok, thanks. I was just curious if you had a specific suggestion, since I've been trying to figure out how to solve this for a while. :)
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: