User:DavidBertenshaw/Assignment 01: Build the Fox

From CDOT Wiki
Jump to: navigation, search


I started working on the project on September 17th. The first thing I did was follow the link to From there I managed to find a link to guide for building Firefox on a windows platform. This guide was the key to finishing this assignment, without it I would be lost and would never have gotten firefox to build properly. Even with this guide I suffered some hardships but eventually managed to complete my build.

Build Prerequisites

From the start I closely followed two websites. The Mozilla build documentation and David Humprey's guide to building Firefox . The following is the software needed to build Firefox on a Windows XP SP2 computer:


This software is used to unpack the zip archive from the Mozilla FTP. If you are using cvs to download the Firefox source then you shouldn't need this.


From what I can tell, this software emulates a Unix shell and in doing so downloads many commands and tools you need to compile Firefox. Once you download Cygwin follow the steps for installation. I used Unix shell endings and I also checked the following options.

   *  patchutils (under Interpreters).
   *  perl (under Interpreters).
   *  zip, unzip (under Archive).  

Don't check Make unless it's version 3.80.

Make 3.80

I am putting this seperate because I had to download the Make software seperatly as I coulnd't find it in the Cywin tools. From what I can tell this utility does the actually building of Firefox.

Visual Studio 2003 or Visual Studio 2005

Both Visual studios have tools that are neccesary to build Mozilla's Firefox. I personally had 2003 installed but switched to 2005 to try and fix a bug, which it didn't. Although you can get free tools out on the net, this is what I used and can say works.


These tools created by Mozilla are used to build Firefox but I couldn't tell exsactly what they do.


From what I can tell this software is needed to create an installer for Firefox.


This process outlines the second time I attemped at building Firefox. The first time was not a success and I will report it in the Conflicts section.

1) Firstly I created a directory called Proj under the c:\ drive. (I am going to outline the small steps as they were the ones that tripped me up the first time).

2) Next download the MozTools, extracted them, and placed the directory in c:\proj\moztools\. I also added this to my path, not sure if that's required though.

3)Once those tasks were done I installed cygwin and configured it as per the Cygwin Configuration.

4)A batch script is needed to configure the system so that the right variables are in the path and such. I created a batch script called SetupFireFox.bat with the following code inside.

@echo off

rem --- CVS Setup

rem --- Setup the paths to the moztools build libraries
set MOZ_TOOLS=C:\proj\moztools

rem --- Scrub these variables first
SET PATH=C:\;C:\windows\system32;C:\windows\system32\wbem

rem --- Prepend cygwin
SET PATH=C:\cygwin\bin;%PATH%

rem --- Setup VC8 compiler environment vars
CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86

rem --- Add glib/libidl to build environment

rem --- moztools comes last after glib/libIDL

5) Check out the build via cvs by typing 'cvs login' from c:\proj. Then type:

cvs co mozilla/browser/config mozilla/

This will create the mozilla directory.

6) I then proceeded to move into the mozilla directory and create a file called mozconfig. I added the following code to mozconfig:

# Building Firefox Trunk with Debugging
. $topsrcdir/browser/config/mozconfig

# Put all obj files in one place, not in src tree
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-objdir
ac_add_options --disable-static
ac_add_options --enable-shared

# Debug Build Setup Options
ac_add_options --disable-optimize
ac_add_options --enable-debug

# I'm using Canvas for my work
ac_add_options --enable-canvas

7)While in the same directory I typed:

make -f checkout

Which will check out the client.

8) Before building I had to ensure that I had all of the tools installed. I installed Visual Studio 2005 and then NSIS. After I added NSIS to the path. This step also ment downloading make 3.80 and adding it to the path.

9) While in c:\proj I ran my batch script. Once the environment was setup I typed 'make -f build' to build the software.


1) C compiler cannot create files

On my first time attempt building Firefox I received this error. I thought that my C++ compiler wasn't working and tried installing one and adding it to my path. No success.


After stumbling around the net for a while someone wrote "Use the command window from Visual Studio". I didn't think of that all for some reason. When I opened command prompt from visual studio I got past this error. By using that command window I guess I was referencing my Visual Studio copy of C++ which the build could understand.

2) Linker Error

After fixing my previous error I quickly came upon a new one. This one I had already read on a tutorial earlier and was quick to fix it. For some reason the build may give a linker error related to the file in Cygwin's bin called 'link'


Change the file in Cygwin's bin directory named 'Link.exe' to something else. It will no longer interfer with the build afterwards.

3) Error code 2

If you stumble upon this during your code it isn't easy to diagnose. I say this because for me it seemed that error code 2 can apply to a lot of different problems. For a long time during this build I was having many types of errors with this error code attached.


I realized, when after hours I figured out my problem , that this error was because of something dumb I was doing. I was reading some other documentation which mentioned I had to download and run Cygwin to get Firefox to build. From what I understand Cygwin is a Unix interface for windows. I thought that I had to build Firefox through that Unix command window. Though I'm sure this is possible I was downloading (and trying to use) windows tools which obviously did not work.


I'd firstly like to thank those who assisted me in overcoming my conflicts. I spent some time on IRC where I receieved assistance from Dejan Tolj who helped me by working with me to identify the problem. Dave Humphrey also assisted me in providing me with knowledge sources and resources.

Liz Chak's guide to building Firefox was one of the most helpful pieces of documentation during my struggle. I found the posting of students successes very valuable for I could search for a student who had a similar experience as mine and then read their troubleshooting to understand how they overcame the conflict.


David Humphrey's Guide to Building Firefox was a useful resorce as a guideline but it was missing some small details that required some research.

The Mozilla documentation is also very detailed and easy to read. I found this also a useful asset in building Firefox




In conclusion though I found this to be a stressful exercise it forced me to get involved with IRC and I now have a better understanding of the open source community. It was also very rewarding when the software finally did build. Overall I am satisfied that the task is over and I am glad that I've sparked some interest in open source development.