If you’ve been trying to build Firefox using the Mozilla build tool, you may have encountered the following
mach build errors :
command line error MIDL1004 : cannot execute C preprocessor cl.exe
mozmake.EXE: * [c:/mozilla-source/mozilla-central/config/recurse.mk:33: export] Error 2 0:58.03
mozmake.EXE: * [c:/mozilla-source/mozilla-central/config/rules.mk:453: default] Error 2 0:58.03
mozmake.EXE: * [c:/mozilla-source/mozilla-central/client.mk:424: realbuild] Error 2
Bug 1397263 seems to cause an issue with the latest version of Mozilla build and its support with MIDL imports.
A workaround to successfully build:
**Assuming you’ve already installed MozillaBuild 3.0 Latest
- In C:/mozilla-build rename the existing start-shell.bat to start-shell.bat.bak
- Download and save the following files from the MozillaBuild 2.2.0 release to your existing C:/mozilla-build directory
- Start the mozilla-build bash window by opening start-shell-msvc2015.bat
- Execute the following commands:
//select option 2
//select yes to take you through the setup
mach build //This will take a while
Your browser should successfully compile and launch.
If you’re experiencing any other build issues or have an alternative solution, feel free to comment below.