Building Firefox

Today I took on the challenge of building Firefox. This post will outline the process I followed as well as some of the challenges I faced.

First off I would like to note that I made the mistake of trying to build Firefox on my laptop which was purchased in 2013. At one point my laptop was running so hot (maxed out CPU for 30+ minutes will do that) it nearly burned my leg and I had to put it against a fan to get extra air flow. With that being said, the build was pretty straight forward as Mozilla has excellent build documentation.

I started off this task by installing and updating all of the prerequisites. As I am attempting this build on Windows, your prerequisites may be different. I may attempt this in the future on Linux but that will come with time (literally spare time). Here are the prerequisites I made sure to have:

  • Mercurial
  • MozillaBuild
  • Rust
  • Visual Studio 2017 Enterprise with:
    • Desktop development with C++
    • Game development with C++
    • VC++ 2017  toolset (x86,x64)
    • Windows 10 SDK for Desktop C++ x86 and x64
    • Visual C++ ATL support

Once I had all of the prerequisites installed and updated I made sure to update my .bashrc file under my user folder to have the path include the bin folder from rust by adding the line:


I then navigated to a folder I wanted to have the repository cloned to and ran the command:

hg clone firefox

Mercurial Clone Firefox

This took quite some time as the size of the repository is quite large (>1GB). When it finished I navigated through the firefox directory that had been created and took a look at some of the code that makes Firefox tick. I tinkered around with some of the code under the browser/base/content directory to add a personal touch to my build. I then executed start-shell.bat under the mozilla-build directory, navigated to the repository, and ran:

mach bootstrap

This command prompted me a couple of time for configuration settings for the build environment such as my name and whether or not I wanted to commit to Mozilla. After I finished with the configuration it told me I was ready to build Firefox, sweet! So I then ran:

mach build

And an error has occurred… Visual Studio’s Compiler is unable to find cl.exe. Such a frustrating thing to happen considering I followed all of the steps. Thankfully I read the installation documentation and it had suggested checking out Bugzilla. After doing a bit of searching, altering my query, and probably some dumb luck I stumbled across bug report #1383578. It essentially outlined that certain paths weren’t being loaded due to spaces in their path being quoted improperly due to the location of a double quote in start-shell.bat. So in the bat file I changed line 42 from

  SET PATH="%PATH%;!LLVMDIR!\bin"mach bootstrap
  SET "PATH=%PATH%;!LLVMDIR!\bin"mach bootstrap

I then tried the build command again and success! The build process started with no more errors. Now to anyone who may be following along, if you aren’t doing this on some bleeding edge computer, go grab a cup of coffee, call a friend, take your dog out for a walk, watch a movie, do something other than stare at the screen cause this is going to take quite some time.

And it is finally done! Welcome to cat build 😀

Leave a Reply

Your email address will not be published. Required fields are marked *