Closed Bug 1841367 Opened 2 years ago Closed 2 years ago

mach build fails with syntax error

Categories

(Firefox Build System :: General, defect)

4.0 Branch
defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: marmanasu, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0

Steps to reproduce:

Follow the instructions in the Building Firefox on Windows article (https://firefox-source-docs.mozilla.org/setup/windows_build.html)

Actual results:

Attempting to run ./mach build fails with the following error messages:

make6944-2.sh: line 1: syntax error near unexpected token (' make6944-2.sh: line 1: C:\Program Files (x86)\GnuWin32\bin -C C:/mozilla-source/mozilla-unified/obj-x86_64-pc-windows-msvc '
mozmake: *** [client.mk:60: build] Error 2

The error appears to result from the space in the filepath for the GnuWin32 installation, but reinstalling GnuWin32 to a filepath which does not contain whitespace yields the same error. Reinstalling MozillaBuild and re-bootstrapping did not change the displayed filepath to the actual install location of GnuWin32 - it seems that the default install location is assumed, even though that filepath causes a syntax error.

Expected results:

The build should finish successfully.

Can you attach the complete output of ./mach build after you remove obj-x86_64-pc-windows-msvc?

Flags: needinfo?(marmanasu)
Attached file build output
After removing obj-x86_64-pc-windows-msvc and setting the "make" environment variable to the correct installation path, I get the following output:

Can you apply this patch:

diff --git a/client.mk b/client.mk
index 04fe5161ed87e..90e99aae71312 100644
--- a/client.mk
+++ b/client.mk
@@ -30,6 +30,8 @@ MOZ_MAKE_FLAGS += --output-sync=line
 endif
 endif
 
+$(info MAKE = $(MAKE))
+$(info MOZ_MAKE_FLAGS = $(MOZ_MAKE_FLAGS))
 MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR)
 
 ifdef MOZBUILD_MANAGE_SCCACHE_DAEMON

Run ./mach build again and paste its output?

Apologies for the delay, after applying that patch I get the following output:

$ ./mach build
 0:01.81 W Clobber not needed.
 0:03.29 W Adding make options from None
    MOZ_OBJDIR=C:/mozilla-source/mozilla-unified/obj-x86_64-pc-windows-msvc
    OBJDIR=C:/mozilla-source/mozilla-unified/obj-x86_64-pc-windows-msvc
  Parallelism determined by memory: using 12 jobs for 12 cores based on 15.9 GiB RAM and estimated job size of 1.0 GiB
 0:03.30 C:/Users/Who/.mozbuild/mozmake/mozmake.exe -f client.mk -j12 -s
 0:03.32 MAKE = C:/Programs/GnuWin32/bin
 0:03.32 MOZ_MAKE_FLAGS =
 0:03.43 process_begin: CreateProcess(NULL, C:/Programs/GnuWin32/bin -C C:/mozilla-source/mozilla-unified/obj-x86_64-pc-windows-msvc, ...) failed.
 0:03.44 make (e=5): Access is denied.
 0:03.44 mozmake: *** [client.mk:62: build] Error 5
 0:03.44 W 0 compiler warnings present.

Can you try running C:/Users/Who/.mozbuild/mozmake/mozmake.exe -f client.mk -j12 -s instead of ./mach build?

Output:

$ C:/Users/Who/.mozbuild/mozmake/mozmake.exe -f client.mk -j12 -s
client.mk:19: *** client.mk must be used via `mach`. Try running `./mach `.  Stop.

Can you try again with C:/Users/Who/.mozbuild/mozmake/mozmake.exe -f client.mk -j12 -s MACH=1?

Output:

$ C:/Users/Who/.mozbuild/mozmake/mozmake.exe -f client.mk -j12 -s MACH=1
MAKE = C:/Users/Who/.mozbuild/mozmake/mozmake.exe
MOZ_MAKE_FLAGS =
client.mk:24: /.mozconfig-client-mk: No such file or directory
mozmake: *** No rule to make target '/.mozconfig-client-mk'.  Stop.

Where the hell does the difference in MAKE between comment 4 and comment 8 come from?

Does applying this patch fix it?

diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py
index 8dc9f90dbf641..b0fa7cabfb985 100644
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -784,6 +784,7 @@ class MozbuildObject(ProcessExecutionMixin):
 
         append_env = dict(append_env or ())
         append_env["MACH"] = "1"
+        append_env["MAKE"] = self.substs["GMAKE"]
 
         params = {
             "args": args,

That patch fixed it, it now builds successfully! I have no idea why MAKE is different now, the change persisted after your last patch but doesn't seem to have prevented the build from finishing.

Flags: needinfo?(marmanasu)
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: