Liz Chak Assignment 1
Build Prerequisites
Hardware Requirements
My copy of Mozilla is built on a system with the following hardware (and it took less than an hour):
- AMD Sempron Processor 3000+
- 1.80 GHz
- 512 MB of RAM
- Windows XP Professional operating system
Tools Requirements
Before I proceed with the Firefox build, the following tools are installed:
Visual Studio.NET 2005
- Obtain a copy of VS.NET 2005 from ACS downloads.
- Download Daemon Tools to extract the iso files.
- Run the installer, it will cleanly install VS.NET 2005.
Cygwin
- Download Cygwin here.
- Run the installer.
- Make sure that the following packages are checked during your installation or else you will run into problems (which I've experienced because I didn't double check if I check marked all of the following package):
- 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)
Configuration
Here are the steps that I took to configure the environment for the Firefox build:
Configure the environment
- Make a directory for the source and build system:
$mkdir C:\proj
- Make a directory called moztools in C:\proj\
- Download and extract the static moztools libraries for Visual C++ to C:\proj\moztools
- To setup the appropriate environment variables and paths, create a build script called buildsetup.bat in C:\proj. Copy and paste the following script into buildsetup.bat:
@echo off rem --- CVS Setup SET CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot SET CVS_RSH=ssh rem --- Setup the paths to the moztools build libraries set MOZ_TOOLS=C:\proj\moztools set GLIB_PREFIX=%MOZ_TOOLS% set LIBIDL_PREFIX=%MOZ_TOOLS% 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 PATH=%PATH%;%GLIB_PREFIX%;%GLIB_PREFIX%\bin SET INCLUDE=%GLIB_PREFIX%\include;%INCLUDE% SET LIB=%GLIB_PREFIX%\lib;%LIB% rem --- moztools comes last after glib/libIDL SET PATH=%PATH%;%MOZ_TOOLS%\bin5. Run the buildsetup.bat script in C:\proj:
$buildsetup.bat
Check out mozilla source
- Login to the mozilla CVS repository in C:\proj:
$cvs login
- Type in anonymous as the password when prompted
- Checkout the build script in C:\proj\
$cvs co mozilla/browser/config mozilla/client.mk
- A C:\proj\mozilla directory is created.
- It takes awhile for the source to get downloaded. Be patient.
4. After source is downloaded successfully, create a text file .mozconfig in the editor of your preference in C:\proj\mozilla
# 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
5. Get the full source from CVS:
$cd \proj\mozilla $make -f client.mk checkout6. Build the source in C:\proj\mozilla
$make -f client.mk build
Problems and Solutions
Problem: To build the installer makensis is required in your path
The very first problem I encountered after I started to build took me merely a couple minutes to solve thanks to my great old friend Google. The command prompt spurted out this error message:
checking for makensis... no configure: error: To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.
Solution: To build the installer makensis is required in your path
I found my solution on a forum. Basically I just added "ac_add_options --disable-installer" to my .mozconfig file.
Problem: "target `c' doesn't match the target pattern" error
The next problem I encountered was a little trickier. The error code was:
../coreconf/rules.mk:365: target `c' doesn't match the target pattern ../coreconf/rules.mk:406: target `c' doesn't match the target pattern ../coreconf/rules.mk:407: warning: overriding commands for target `c' ../coreconf/rules.mk:366: warning: ignoring old commands for target `c' ../coreconf/rules.mk:437: target `c' doesn't match the target pattern ../coreconf/rules.mk:438: warning: overriding commands for target `c' ../coreconf/rules.mk:407: warning: ignoring old commands for target `c' ../coreconf/rules.mk:445: target `c' doesn't match the target pattern ../coreconf/rules.mk:446: warning: overriding commands for target `c ../coreconf/rules.mk:438: warning: ignoring old commands for target `c' ../coreconf/rules.mk:449: target `c' doesn't match the target pattern ../coreconf/rules.mk:450: warning: overriding commands for target `c' ../coreconf/rules.mk:446: warning: ignoring old commands for target `c' ../coreconf/rules.mk:464: target `c' doesn't match the target pattern ../coreconf/rules.mk:465: warning: overriding commands for target `c' ../coreconf/rules.mk:450: warning: ignoring old commands for target `c' ../coreconf/rules.mk:468: target `c' doesn't match the target pattern ../coreconf/rules.mk:469: warning: overriding commands for target `c' ../coreconf/rules.mk:465: warning: ignoring old commands for target `c' ../coreconf/rules.mk:966: *** multiple target patterns. Stop.
My typical solution to any problems is "consulting" my old friend Google. It seemed like quite a few people encountered the same problem. I found out from a forum that the problem was that I didn't have the right version of Make. I had Make 3.81 which should have been Make 3.80.
I pulled up the GNU Tools for Microsoft Windows (Cygwin) installation guide again, and realized that I have missed out the part where it mentioned make 3.80 (not 3.81!) -- dependency analyzer for software builds (Devel category) as one of the required packages. However, when I reinstalled Cygwin again, it didn't give me an option to choose Make 3.80!! (I think this is a serious issue and should be outlined in the Windows Build Documentation)
I tried various solutions (hunted for an older version of Cygwin to install and linking Make 3.80 from Cygwin with ln -s command) but my build still failed. After several unsuccessful attempts, I consulted Sancus (Andrei Hajdukewycz) for a solution, and the miracle happened, Firefox was then successfully built!!
Solution to "target `c' doesn't match the target pattern" error
- Install Cywgin from here
- Download Make 3.80
- Extract it and install it
- As it is a binary package, you could just grab the Make executable file (make.exe) from /usr/bin/ and drop it in Cywgin/bin (this will overwrite the existing Make executable)
- Double check if you have the right Make package by typing this command:
$ make -v GNU Make 3.80
Voila!
I also learned from Sancus that you can dump the Make package in your Cygwin packages temp directory and the installer will let you install it. The mirrors don't seem to have properly set up setup.hint files to point to the old versions of the Make files.
Resources
I wouldn't have successfully built without the following documentations:
- Windows Build Prerequisites
- David Humphrey's Guide to Building Firefox on Win32 using Visual Studio .NET 2005
- Mozillazine
- Getting Make to place nice with Cygwin
- ACS
- Cygwin
- Mozilla Developer Center
- Mozilla Build Documentation
Special thanks to Andrei Hajdukewycz for guiding me through the most difficult part of the build process!!
Conclusion
From my experience in building Mozilla Firefox, I have learned the value of working in a community. I wouldn't have successfully built one of the world's biggest projects hadn't I met Sancus in irc://irc.mozilla.org/#seneca who gave me some pointers. The Mozilla forums were definitely helpful too, especially when the postings regard to the same problem you're encountering. Not only have I made a friend, I've also successfully built one of the world's biggest projects and have stepped my foot in the Mozilla community. This experience is definitely an eye-opener.