Search code examples
firefoxbuild

Firefox build lld-link:error: failed to write the output file: permission denied


I'm trying to build the Mozilla Firefox code, and I ran upon this error:

0:20.09 checking host system type... x86_64-pc-mingw32
0:21.22 checking target system type... x86_64-pc-mingw32
0:22.26 checking build system type... x86_64-pc-mingw32
0:23.18 checking for Cygwin environment... no
0:23.98 checking for mingw32 environment... no
0:24.66 checking for executable suffix... configure: error: installation or con
figuration problem: compiler cannot create executables.
0:24.69 DEBUG: <truncated - see config.log for full output>
0:24.69 DEBUG: #endif
0:24.69 DEBUG: return __CYGWIN__;
0:24.69 DEBUG: ; return 0; }
0:24.71 DEBUG: configure:871: checking for mingw32 environment
0:24.71 DEBUG: configure:883: c:/Users/Moonchild/.mozbuild/clang/bin/clang-cl.e
xe -Xclang -std=gnu99 -c   conftest.c 1>&5
0:24.73 DEBUG: configure(879,8): error: use of undeclared identifier '__MINGW32__'
0:24.73 DEBUG: return __MINGW32__;
0:24.73 DEBUG:        ^
0:24.73 DEBUG: 1 error generated.
0:24.73 DEBUG: configure: failed program was:
0:24.73 DEBUG: #line 876 "configure"
0:24.74 DEBUG: #include "confdefs.h"
0:24.74 DEBUG:
0:24.74 DEBUG: int main() {
0:24.74 DEBUG: return __MINGW32__;
0:24.74 DEBUG: ; return 0; }
0:24.74 DEBUG: configure:902: checking for executable suffix
0:24.74 DEBUG: configure:912: c:/Users/Moonchild/.mozbuild/clang/bin/clang-cl.exe -Xclang -std=gnu99 -c   conftest.c 1>&5 && c:/Users/Moonchild/.mozbuild/clang/bin/lld-link.exe -OUT:conftest   conftest.obj  1>&5
0:24.74 DEBUG: lld-link: error: failed to write the output file: permission denied
0:24.76 DEBUG: configure: error: installation or configuration problem: compiler cannot create executables.
0:24.76 ERROR: old-configure failed

This is in a new, fully updated Windows 7 VM after running bootstrap.py all exactly according to Mozilla's build guidelines (including the proposed default directory names and everything). The user account used is administrator level so there should not be any write permission errors on the file system. I haven't been able to get an answer to this in Mozilla's chat room about this yet so thought I'd toss it up here too in case someone else has run into the same and knows how to solve this issue.


Solution

  • Apparently this is a problem with Mozilla's specifically tooled version of clang 11 that is being pulled down through the bootstrap script. Dropping in an older clang version from Mozilla's CI allows one to get past this.

    See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1699228