Open main menu

CDOT Wiki β

Assignment 1: Building the Fox

Revision as of 21:09, 19 September 2006 by Ankuswan (talk | contribs) (Screenshot)

Introduction

I built Firefox merely a day before the deadline due to busy schedule. Unfortunately, this means I had a fair share of horror stories from other peers in the course who had gone through the mire. On the other hand, this circumstance allows me to receive plenty of support and advice from them, of which I am grateful.

Built Environment

I use the following system to build my Firefox:

  • Pentium M 1.86 GHz, 512 MB RAM
  • 80 GB Hard Drive
  • Windows XP Home - SP2
  • MS Visual Studio .NET 2003 already installed

Initial Setup

For the preparation for the build, I first read the Mozilla Development Center Build Documentation, but quickly ran out of patience. Then I found another website that offers a more compressed set of instructions.

  • First, I downloaded and installed Cygwin, following the instruction here. There is an extra step involved in getting make 3.80 detailed at the Problems section.
  • I already have Visual Studio .NET 2003 installed, so I didn't install any SDK suggested by the site.
  • I downloaded Moztools, and unpacked it as instructed.
  • I created a batch file following this template and name it mozset.bat. I later edited the batch file, reducing it to this:
set HOME=C:\home

set VCVARS=C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin\vcvars32.bat

set MOZ_TOOLS=C:\moztools
set CVSROOT=:pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot

set CYGWINBASE=C:\cygwin
set CYGWIN=nodosfilewarning

set PATH=%CYGWINBASE%\bin;%PATH%

call "%VCVARS%"
 
set PATH=%PATH%;%MOZ_TOOLS%\bin

bash --login -i
  • Lastly, I retrieved Mozilla source using cvs as instructed here.
mozset
cvs login
cvs co mozilla/client.mk
  • Prior to the build, I created .mozconfig file and place it on the mozilla directory at c:/home. I used the template from the source site at first, but then modified it using Elizabeth Chak's version here. This is the resulting file:
. $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-shared
ac_add_options --disable-static
ac_add_options --enable-debug
ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
ac_add_options --enable-canvas
ac_add_options --disable-installer

Build Process

Compared to the initial setup, the building process is not complicated, but more messy in comparison, due to my being clueless at the entire process. The process took many retries due to various problems, which will be discussed later. Here's the successful step-by-step process.

  • First, I ran the mozset.bat to set up the environment, and then switch to the project directory.
mozset.bat
cd mozilla
  • Then I downloaded the source files. This process took approximately 25 minutes in my computer as it populated the previously-sparse c:/home/mozilla.
$ make -f client.mk checkout MOZ_CO_PROJECT=browser
  • Finally, I started the compilation process.
$ make -f client.mk build

The entire process took around 25 minutes to download the files and 90 minutes to complete the compilation. At first I had a bunch of applications running while Firefox compiled, making it slow. Closing most of the applications could have hastened the process.

Once the process is done, I checked C:\proj\mozilla\firefox-objdir\dist\bin, double-clicked the mine, got roughed up a bit by error messages, and found the Fox running.

Problems Encountered

Despite the instructions above, the process was far from smooth. I was derailed many times due to various issues. Here is the list of problems encountered, and how I managed to solve it.

Problem 1 : Use MOZ_CO_PROJECT to specify a project for checkout..

During the first run, I used this command to download the files.

$ make -f client.mk checkout

The downloading process never started, and the screen displayed this error.

mozilla/client.mk:761: *** No modules or projects were specified. Use MOZ_CO_PROJECT to specify a project for checkout..  Stop.

This message was confusing, as many references instructs this step without any hassle. I supposed MOZ_CO_PROJECT is some kind of flag I have to set in order to run the process. I decided to read other submissions and found a solution in Philip Vitorino's page. Here's the corrected command:

$ make -f client.mk checkout MOZ_CO_PROJECT=browser

Later I discovered that I could have avoided such headache if I had had the time and patience to read the contents of client.mk. The file contains a documentation on how to use the flag to choose the Mozilla suite to download.

Problem 2 : Wrong Firefox.exe run

Once the compilation is finished, I searched mozilla\firefox-objdir\browser\apps and found Firefox.exe, which I immediately ran. The program crashed immediately with this pop-up error:

This application has failed to start because xul.dll was not found. Re-installing the application may fix this problem.

Only later that I found the correct file to run at mozilla\firefox-objdir\dist\bin. Multiple executables located in the trunk can potentially confuse anyone who didn't bother to read directions...

Problem 3 : Wrong Firefox version

When I double-clicked the (right) Firefox.exe, the program ran immediately, but when the About window is displayed, it displayed version 1.5.0.7. Alarmed, I contacted Sherman Fernandes, who advised me to turn off all opened Firefox windows (which I used to display references). The problem was immediately resolved.

Problem 4 : make 3.80

Various sources instructed not to use make 3.81, which can be included in the Cygwin installation, so I left it unchecked. During installation, I found myself not having make.exe at all. Luckily, Elisabeth Chak's submission conveniently provided a link.

Screenshot

 

Acknowledgement

Reflection