Bug 1377157 - remove VCINSTALLDIR from cargo's environment when running in MozillaBuild; r=ted.mielczarek
authorNathan Froyd <froydnj@mozilla.com>
Thu, 29 Jun 2017 13:41:57 -0400
changeset 366727 50130098edb3dc1f8bb1509da306d74e738003e2
parent 366726 1c9b8d85935ed3aa95bdf4b94396568db962940a
child 366728 a648e9c988176feadae58ef22c6951b0892dbc58
push id92029
push usernfroyd@mozilla.com
push dateThu, 29 Jun 2017 19:12:46 +0000
treeherdermozilla-inbound@50130098edb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted.mielczarek
bugs1377157
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1377157 - remove VCINSTALLDIR from cargo's environment when running in MozillaBuild; r=ted.mielczarek Stable Rust currently has logic similar to the following for finding the linker on Windows: if VCINSTALLDIR in os.env: search for things in PATH if found, return, otherwise fallthrough look for MSVC installations of various kinds For our current MozillaBuild setup where we clear out PATH prior to invoking Cargo, this works: even though VCINSTALLDIR is set and we (unsuccessfully) search through an empty PATH, we'll still fallback to looking for MSVC installations. Beta Rust has altered this search strategy: if VCINSTALLDIR in os.env: search for things in PATH return the result of the search, regardless of success look for MSVC installations of various kinds Note that in the above logic, if VCINSTALLDIR is set, we are only going to try looking in PATH for an appropriate linker. Since PATH is empty in our current MozillaBuild setup, beta Rust will therefore fail to find the correct linker. This failure causes numerous problems. Since Firefox is already trying to "clean" the environment that Cargo is invoked in, we should work a little bit harder by unsetting VCINSTALLDIR entirely, and simply force Rust to search for known MSVC installations. Making this change makes stable and beta Rust behave identically. (We don't have to worry about this distinction in automation, because the "cleaning" code is only activated when we detect a MozillaBuild shell.)
config/rules.mk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -886,17 +886,17 @@ rustflags_override = RUSTFLAGS='$(defaul
 ifdef MOZ_MSVCBITS
 # If we are building a MozillaBuild shell, we want to clear out the
 # vcvars.bat environment variables for cargo builds. This is because
 # a 32-bit MozillaBuild shell on a 64-bit machine will try to use
 # the 32-bit compiler/linker for everything, while cargo/rustc wants
 # to use the 64-bit linker for build.rs scripts. This conflict results
 # in a build failure (see bug 1350001). So we clear out the environment
 # variables that are actually relevant to 32- vs 64-bit builds.
-environment_cleaner = PATH='' LIB='' LIBPATH=''
+environment_cleaner = -u VCINSTALLDIR PATH='' LIB='' LIBPATH=''
 # The servo build needs to know where python is, and we're removing the PATH
 # so we tell it explicitly via the PYTHON env var.
 environment_cleaner += PYTHON='$(shell which $(PYTHON))'
 else
 environment_cleaner =
 endif
 
 rust_unlock_unstable =