Closed Bug 1377157 Opened 5 years ago Closed 5 years ago

Rust 1.19 hits error: could not exec the linker `link.exe`


(Firefox Build System :: General, defect)

Not set


(firefox56 fixed)

Tracking Status
firefox56 --- fixed


(Reporter: away, Assigned: froydnj)


(Blocks 1 open bug)



(1 file)

Originally but after some debugging it seems the fix should be on the gecko side. See
Assignee: nobody → nfroyd
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

It's not clear to me whether we should have been using -u for the other
environment variables we're cleaning here, but one step at a time, I
Attachment #8882273 - Flags: review?(ted)
Comment on attachment 8882273 [details] [diff] [review]
remove VCINSTALLDIR from cargo's environment when running in MozillaBuild

Review of attachment 8882273 [details] [diff] [review]:

I wish this whole situation was better, but making things work is better than having them not work.
Attachment #8882273 - Flags: review?(ted) → review+
Pushed by
remove VCINSTALLDIR from cargo's environment when running in MozillaBuild; r=ted.mielczarek
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.