Closed Bug 1385241 Opened 5 years ago Closed 5 years ago

Remove Mozillabuild bootstrap Rust installation code


(Firefox Build System :: General, defect)

Not set


(firefox57 fixed)

Tracking Status
firefox57 --- fixed


(Reporter: mayhemer, Assigned: bryce)


(Blocks 1 open bug)



(1 file)

Windows 10, start-shell-msvc2015.bat, up to date m-c, mozilla-build 2.2.0

$ ./mach bootstrap
mach bootstrap is not fully implemented in MozillaBuild

Please choose the version of Firefox you want to build:
1. Firefox for Desktop Artifact Mode
2. Firefox for Desktop
3. Firefox for Android Artifact Mode
4. Firefox for Android

Note on Artifact Mode:

Firefox for Desktop and Android supports a fast build mode called
artifact mode. Artifact mode downloads pre-built C++ components rather
than building them locally, trading bandwidth for time.

Artifact builds will be useful to many developers who are not working
with compiled code. If you want to work on look-and-feel of Firefox,
you want "Firefox for Desktop Artifact Mode".

Similarly, if you want to work on the look-and-feel of Firefox for Android,
you want "Firefox for Android Artifact Mode".

To work on the Gecko technology platform, you would need to opt to full,
non-artifact mode. Gecko is Mozilla's web rendering engine, similar to Edge,
Blink, and WebKit. Gecko is implemented in C++ and JavaScript. If you
want to work on web rendering, you want "Firefox for Desktop", or
"Firefox for Android".

If you don't know what you want, start with just Artifact Mode of the desired
platform. Your builds will be much shorter than if you build Gecko as well.
But don't worry! You can always switch configurations later.

You can learn more about Artifact mode builds at

Your choice: 2
info: updating existing rustup installation

error: component 'rust-std' for target 'i686-pc-windows-msvc' is required for toolchain 'stable-i686-pc-windows-msvc' and cannot be re-added
Error running mach:


The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error

The details of the failure are as follows:

CalledProcessError: Command '[u'c:/Users/xmayhemer\\.cargo\\bin\\rustup', 'target', 'add', 'i686-pc-windows-msvc']' returned non-zero exit status 1

  File "c:\Mozilla\src\mozilla-central1\python/mozboot/mozboot/", line 32, in bootstrap
  File "c:\Mozilla\src\mozilla-central1\python/mozboot\mozboot\", line 240, in bootstrap
  File "c:\Mozilla\src\mozilla-central1\python/mozboot\mozboot\", line 23, in install_system_packages
  File "c:\Mozilla\src\mozilla-central1\python/mozboot\mozboot\", line 45, in install_rustup[rustup, 'target', 'add', 'i686-pc-windows-msvc'])
  File "c:\Mozilla\src\mozilla-central1\python/mozboot\mozboot\", line 84, in run
    subprocess.check_call(command, stdin=sys.stdin)
  File "c:\Mozilla\mozilla-build\python\lib\", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
Doesn't go away with MozillaBuild 3.0.0

$rustup install stable-i686-pc-windows-msvc 

doesn't help

if rustup command can't be found, try restarting the terminal.
mach is trying to install rust even it's already there.  mach is missing a check if it's already installed.

a quick and dirty fix in case you are facing this issue and need to move on:

diff --git a/python/mozboot/mozboot/ b/python/mozboot/mozboot/
--- a/python/mozboot/mozboot/
+++ b/python/mozboot/mozboot/
@@ -15,17 +15,17 @@ class MozillaBuildBootstrapper(BaseBoots
     def __init__(self, no_interactive=False):
         BaseBootstrapper.__init__(self, no_interactive=no_interactive)
         print("mach bootstrap is not fully implemented in MozillaBuild")

     def which(self, name):
         return BaseBootstrapper.which(self, name + '.exe')

     def install_system_packages(self):
-        self.install_rustup()
+        return

     def install_rustup(self):
             rustup_init = tempfile.gettempdir() + '/rustup-init.exe'
(In reply to Honza Bambas (:mayhemer) from comment #3)
> a quick and dirty fix in case you are facing this issue and need to move on:

Credit: Ted!
MozillaBuildBootstrapper.install_rustup unconditionally installs rustup:

rustup mostly handles this OK, but it also unconditionally runs `rustup target add i686-pc-windows-msvc`, which fails if it already exists, so bootstrap fails even though all the Rust bits are actually there.

mozboot.base already has an `ensure_rust_modern` that ought to work fine:

and in fact the main bootstrap process will call that after `install_system_packages` anyway:

We should just remove the whole `install_rustup` function and let `ensure_rust_modern` do its thing.
The other issue here was that Honza had the `i686-pc-windows-msvc` Rust toolchain installed as the default, and all of our bootstrap machinery assumes the `x86_64-pc-windows-msvc` toolchain will be the default, so we don't handle that case very well. Specifically he was trying to do a 64-bit build, and bootstrap didn't make sure he had the `x86_64-pc-windows-msvc` *target* installed.
Honza fixed his toolchain problem by running `rustup default stable-x86_64-pc-windows-msvc`.
Resummarizing--we should do what I outlined in comment 5.
Summary: ./mach bootstrap: error: component 'rust-std' for target 'i686-pc-windows-msvc' is required for toolchain 'stable-i686-pc-windows-msvc' and cannot be re-added → Remove Mozillabuild bootstrap Rust installation code
Comment on attachment 8905706 [details]
Bug 1385241 - Remove mozilla-build specific rust install. .mielczarek

Thanks for the patch!
Attachment #8905706 - Flags: review?(ted) → review+
Assignee: nobody → bvandyk
We're sorry, Autoland could not rebase your commits for you automatically. Please manually rebase your commits and try again.

hg error in cmd: hg rebase -s ead3aa456707 -d 39b0e0aead7b: rebasing 419820:ead3aa456707 "Bug 1385241 - Remove mozilla-build specific rust install. r=ted.mielczarek" (tip)
merging python/mozboot/mozboot/
warning: conflicts while merging python/mozboot/mozboot/! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
Pushed by
Remove mozilla-build specific rust install. r=ted.mielczarek
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.