From CDOT Wiki
< User:Mckwan
Revision as of 22:03, 19 September 2006 by Mckwan (talk | contribs) (Problems)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The following are the steps I took to build Firefox on Windows XP SP2 using Visual Studio.NET 2005. My first step is to read the build prerequisites for Windows in the Mozilla developer site. Then search “how to build firefox on Windows” on Google. I follow the instructions on David Humphrey's website.

Hardware Configuration

Intel Pentium 4 Processor-M 1.8 MHz
60 gig Hard Drive
Windows XP sp2

Software Requirements

	ash -- UNIX-like command line interpreter shell (Base category) 
	coreutils -- GNU core utilities (includes fileutils, install, sh-utils, and textutils) (Base category) 
	cvs -- concurrent versions system (Devel category) 
	diffutils -- file comparison utility (Base category) 
	findutils (Base category) 
	gawk -- pattern matching language (Base and Interpretors categories) 
	grep -- text search tool (Base category) 
	libiconv -- character set conversion (Devel category) 
	make 3.80 (not 3.81!) -- dependency analyzer for software builds (Devel category) 
	patchutils -- a small collection of programs that operate on patch files (Devel category) 
	perl -- a scripting language used to control parts of the build (Interpreters category) 
	sed -- a search and replace language (Base category) 
	unzip -- zip file extraction (Archive category) 
	zip -- zip file creation (Archive category) 
  • Create a directory C:\assignment1
  • Download and Extract Moztools to C:\assignment1\moztools

Steps to Build Firefox

  • Configure environment variables by create a script called buildsetup.bat in C:\assignment1. (the following code from David's website)
        @echo off

        rem --- CVS Setup
        SET CVS_RSH=ssh

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

        rem --- Scrub these variables first
        SET INCLUDE=
        SET LIB=
        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
        SET LIB=%GLIB_PREFIX%\lib;%LIB%

        rem --- moztools comes last after glib/libIDL
        SET PATH=%PATH%;%MOZ_TOOLS%\bin
  • Run buildsetup.bat in C:\assignment1.
 c:\assignment1> buildsetup 
  • Login to the mozilla CVS repository in C:\assignment1, type anonymous as password when prompted.
 C:\assignment1> cvs login 
  • Check out the build script
 C:\assignment1> cvs co mozilla/browser/config mozilla/
	this will create mozilla directory within C:\assignment1
  • create a text file .mozconfig in mozilla (the following code from David's website)
     # Building Firefox Trunk with Debugging

     # 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

• Check out the source code from cvs

c:\assignment1\mozilla> make -f checkout 

• Finally do the build

c:\assignment1\mozilla> make –f build
Once the build is successful, firefox 3.0 will be in c:\assignment1\mozilla\firefox-objdir\dist\bin


My problem was failing to use the right verison of make to build firefox.

     make[6]: *** [_xpidlgen/nsIContextMenuListener.h] Error 1
     make[6]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir/embedding/browser/webBrowser'
     make[5]: *** [export] Error 2
     make[5]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir/embedding/browser'
     make[4]: *** [export] Error 2
     make[4]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir/embedding'
     make[3]: *** [export_tier_gecko] Error 2
     make[3]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
     make[2]: *** [tier_gecko] Error 2
     make[2]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
     make[1]: *** [default] Error 2
     make[1]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
     make: *** [build] Error 2

elichak told me the site that has an older verison of cygwin. Download cygwinBasic here and install it to a temp directory. Then copy make from the temp directory and paste it into the Cygwin dirctory.


Screenshot of Mozilla Firefox 3.0 (Minefield) Help > About window:

Screenshot of Mozilla Firefox 3.0 (Minefield) Help > About window


I was expecting a lot of problems with the Mozilla Firefox build. It turned out to be better then I expected as building on Windows XP professional sp2 proved to be very easy and straight forward as long as you follow the instruction closely and make sure all the version are correct. The problem I encountered allowed me to understand that the slightest version change can break the build.