Difference between revisions of "Liz Chak Assignment 1"

From CDOT Wiki
Jump to: navigation, search
(Solution to "target `c' doesn't match the target pattern" error)
 
(155 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Under construction!!
+
Submitted by [[User:Elichak|Liz Chak]] (elichak)
 +
 
 +
=Introduction=
 +
I built Firefox on Win32 using Visual Studio .NET 2005. It took me merely 45 minutes to cleanly build Mozilla (dynamic build), but literally the whole night to figure out a [[Liz_Chak_Assignment_1#Problem:_.22target_.60c.27_doesn.27t_match_the_target_pattern.22_error|problem]].
 +
 
 +
I hope this documentation will help those of you heroes who intend to make an attempt to build Firefox on a <b>Windows XP</b> operating system using <b>Visual Student .NET 2005</b> as the compiler.
  
 
=Build Prerequisites=
 
=Build Prerequisites=
 +
 +
==Hardware Requirements==
 +
My copy of Mozilla Firefox is built on a system with the following hardware (and it took less than an hour - dynamic build):
 +
*AMD Sempron Processor 3000+ 1.80 GHz
 +
*512 MB of RAM
 +
*80 gig Hard Drive
 +
*Windows XP Professional operating system
 +
 +
==Tools Requirements==
 +
Before I proceed with the Firefox build, the following tools are installed:
 +
 +
<b>Visual Studio.NET 2005</b>
 +
*Obtain a copy of VS.NET 2005 from [http://acs.senecac.on.ca/pages/download.php ACS downloads] {Note: You need your Seneca Learn ID or Mercury ID to access the site).
 +
*Download [http://www.free-downloads.net/downloads/Daemon_Tools/ Daemon Tools] (or google for Daemon Tools) to extract the iso files.
 +
*Run the installer, it will cleanly install VS.NET 2005. 
 +
 +
 +
<b>Cygwin</b>
 +
*Download Cygwin [http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites#GNU_Tools_for_Microsoft_Windows_.28Cygwin.29 here].
 +
*Run the installer.
 +
*Make sure that the following packages are checked during your installation or else you will run into [[Liz_Chak_Assignment_1#Miscellaneous_problems_and_solutions | 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)
 +
 +
<b>Note: Make 3.80 is no longer available in the Cygwin setup installer.</b>
 +
 +
 +
<b>Make 3.80 (Important to avoid [[Liz_Chak_Assignment_1#Problem:_.22target_.60c.27_doesn.27t_match_the_target_pattern.22_error|problems]])</b>
 +
 +
*Download [http://cygwin.paracoda.com/release/make/make-3.80-1.tar.bz2 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 <b>/usr/bin/</b> and drop it in <b>cywgin/bin</b> (this will overwrite the existing Make executable)
 +
*Double check if you have the right Make package by typing this command (change to the directory <b>cywgin/bin</b>):
 +
<pre>
 +
$ make -v
 +
GNU Make 3.80
 +
</pre>
  
 
=Configuration=
 
=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:<pre>$mkdir C:\proj</pre>
 +
# Make a directory called <b>moztools</b> in <b>C:\proj\</b>
 +
# Download and extract the [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/moztools-static.zip static moztools libraries for Visual C++] to <b>C:\proj\moztools</b>
 +
# To setup the appropriate environment variables and paths, create a build script called <b>buildsetup.bat</b> in <b>C:\proj</b>. Copy and paste the following script into buildsetup.bat:
 +
<pre>
 +
@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%\bin
 +
</pre>
 +
 +
&nbsp;&nbsp;&nbsp;&nbsp;5.&nbsp;&nbsp;Run the <b>buildsetup.bat</b> script in <b>C:\proj</b>:<pre>$buildsetup.bat</pre>
 +
*To check which program you're running, type <b>which link</b> in the command line after you run the environment variable script (buildsetup.bat) and it will tell you the link:
 +
<pre>
 +
$which link
 +
$/cygdrive/c/Program Files/Microsfot Visual Studio 8/VC/BIN/link
 +
</pre>
 +
*It will be  the cygwin or Microsoft link depending on which one you set in the <b>buildsetup.bat</b>
 +
 +
 +
==Check out mozilla source==
 +
#Login to the mozilla CVS repository in <b>C:\proj</b>: <pre>$cvs login</pre>
 +
#Type in <b>anonymous</b> as the password when prompted (NOTE: ignore the error message related to .cvspass)
 +
#Checkout the build script in <b>C:\proj\</b><pre>$cvs co mozilla/browser/config mozilla/client.mk</pre>
 +
#* A <b>C:\proj\mozilla</b> directory is created.
 +
#* It takes awhile for the source to get downloaded. Be patient.
 +
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;4.&nbsp;&nbsp;After source is downloaded successfully, create a text file  with the filename <b>.mozconfig</b> (filename should be exactly how it's spelt: .mozconfig) in the editor of your preference in <b>C:\proj\mozilla</b>
 +
<pre>
 +
# 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
 +
 +
# I disabled the installer
 +
ac_add_options --disable-installer
 +
</pre>
 +
*Note that I have disabled static build, meaning my Firefox will build dynamically: <pre>ac_add_options --disable-static</pre> A static build is one that doesn't need external libraries to run. To run a build dynamically, you require all the development libraries and so on installed. A static build takes more time than a dynamic build.
 +
 +
*Note that I have disabled installer to avoid a [[Liz_Chak_Assignment_1#Problem:_.22To_build_the_installer_makensis_is_required_in_your_path.22_error|problem]] later: <pre>ac_add_options --disable-installer</pre>
 +
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5.&nbsp;&nbsp;Get the full source from CVS (By default, you will build HEAD, which is Firefox 3.0):
 +
<pre>
 +
$cd \proj\mozilla
 +
$make -f client.mk checkout MOZ_CO_PROJECT=browser
 +
</pre>
 +
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;6.&nbsp;&nbsp;Build the source in <b>C:\proj\mozilla</b> <pre>$make -f client.mk build</pre>
 +
 +
The time it takes to build Firefox depends on your machine. It could take as little as 16 minutes or as long as 3 hours! Just be patient and a miracle will happen (unless the console spurts out error code - refer to my list of [[Liz_Chak_Assignment_1#Problems_and_Solutions|problems]] if you encounter any, hopefully it helps).
 +
 +
Your newly built monster, I mean, Firefox will be in <b>C:\proj\mozilla\firefox-objdir\dist\bin</b>. Double click on the executable file that looks like a minefield (and cross your fingers to hope that it wouldn't crash your system).
 +
 +
=My first failed attempt to build Firefox 1.8.1=
 +
After glancing through the [http://developer.mozilla.org/en/docs/Build_Documentation Mozilla Build Documentation], I only needed one word  to describe how I felt, overwhelmed! I started by skimming through the text, and downloaded all the required tools, configured the environment, checked out the source before I started my build. I ran into the problem: <b>The linker major version does not match the compiler suite version7</b>
 +
 +
Without researching further on the problem, I consulted one of my classmates and he said that I had to re-install Visual Studio 2003.  I was skeptical about his way of resolving this problem (and also it would be a hassle since I've uninstalled it a week before this build), so I looked into it further and found out from [http://forums.mozillazine.org/viewtopic.php?t=438157&sid=03462713fcf201b52e92791b2c65d14f Mozillazine] that the solution is to install Cygwin.
 +
 +
I tried a new clean build with [http://cs.senecac.on.ca/%7Edavid.humphrey/writing/firefox-win32-build.html David Humphrey's Guide to Building Firefox on Win32 using Visual Studio .NET 2005] (very concise and recommended for the heroes who want to build Firefox).
 +
  
 
=Problems and Solutions=
 
=Problems and Solutions=
==<big><b>Problem: To build the installer makensis is required in your path</b></big>==
+
==Problem: "To build the installer makensis is required in your path" error==
  
 
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 [http://www.google.com Google]. The command prompt spurted out this error message:
 
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 [http://www.google.com Google]. The command prompt spurted out this error message:
Line 16: Line 166:
 
</pre>
 
</pre>
  
 +
==Solution: "To build the installer makensis is required in your path" error==
  
==<big><b>Solution: To build the installer makensis is required in your path</b></big>==
+
I found my solution on a forum, [http://forums.mozillazine.org/viewtopic.php?t=92495&start=1320&sid=ad7fac8c3bc80a7373a0bf8957a15971 Mozillazine]. Basically I just added "ac_add_options --disable-installer" to my <b>.mozconfig</b> file.
  
I found my solution on a [http://forums.mozillazine.org/viewtopic.php?t=92495&start=1320&sid=ad7fac8c3bc80a7373a0bf8957a15971 forum]. Basically I just added "ac_add_options --disable-installer" to my .mozconfig file.
 
 
  
==<big><b>Problem: "target `c' doesn't match the target pattern" error</b></big>==
+
==Problem: "target `c' doesn't match the target pattern" error==
  
 
The next problem I encountered was a little trickier. The error code was:
 
The next problem I encountered was a little trickier. The error code was:
Line 51: Line 200:
 
My typical solution to any problems is "consulting" my old friend [http://www.google.com 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.
 
My typical solution to any problems is "consulting" my old friend [http://www.google.com 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 [http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites#GNU_Tools_for_Microsoft_Windows_.28Cygwin.29 GNU Tools for Microsoft Windows (Cygwin)] installation guide again, and realized that I have missed out the part where it mentioned <b>make 3.80 (not 3.81!) -- dependency analyzer for software builds (Devel category)</b> 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 pulled up the [http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites#GNU_Tools_for_Microsoft_Windows_.28Cygwin.29 GNU Tools for Microsoft Windows (Cygwin)] installation guide again, and realized that I have missed out the part where it mentioned <b>make 3.80 (not 3.81!) -- dependency analyzer for software builds (Devel category)</b> as one of the required packages. <b>However, when I reinstalled Cygwin again, it didn't give me an option to choose Make 3.80!! </b>
 +
<b>[http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites#GNU_Tools_for_Microsoft_Windows_.28Cygwin.29 Windows Build Documentation is updated - 17:15, Sept 16 2006 (EST)]</b>
  
I tried various solutions (one of them being: hunted for an older version of Cygwin to install) but my build still failed. After several unsuccessful attempts, I consulted [[User:Sancus|Andrei Hajdukewycz]] for a solution, and the miracle happened, Firefox was then successfully built!!
+
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. It was frustrating, because through most of the forums that discussed about this problem, it seemed like everyone didn't have a problem "rolling back to version 3.80". However, the version of Cygwin that I installed didn't have the older version of Make and I wasn't the only person experiencing that problem at that time. Both my classmate and I tried the various solutions as per my suggestions but they all failed. After several unsuccessful attempts, I consulted [[User:Sancus|Sancus (Andrei Hajdukewycz)]] for a solution (which was easier than I thought), and the miracle happened, Firefox was then successfully built!! (Sheds a tear of joy..)
  
 
+
==Solution to the above "target `c' doesn't match the target pattern" error==
==<big><b>Solution to "target `c' doesn't match the target pattern" error</b></big>==
 
 
*Install Cywgin from [http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites#GNU_Tools_for_Microsoft_Windows_.28Cygwin.29 here]
 
*Install Cywgin from [http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites#GNU_Tools_for_Microsoft_Windows_.28Cygwin.29 here]
*Download [http://cygwin.paracoda.com/release/make/make-3.80-1.tar.bz2 Make 3.80]
+
*Download [http://cygwin.paracoda.com/release/make/make-3.80-1.tar.bz2 Make 3.80] (Make sure the existing version on your system is cleanly removed all else there will be version conflicts)
 +
*If that doesn't work then just uninstall make then install version 3.80 from source.
 
*Extract it and install it
 
*Extract it and install it
*As it is a binary package, you could just grab the Make executable file (make.exe) and drop it in Cywgin -> bin (this will overwrite the existing Make executable)
+
*As it is a binary package, you could just grab the Make executable file (make.exe) from <b>/usr/bin/</b> and drop it in <b>cywgin/bin</b> (this will overwrite the existing Make executable)
*Double check if you have the right Make package by typing this command:
+
*Double check if you have the right Make package by typing this command (change to the directory <b>cywgin/bin</b>):
 
<pre>
 
<pre>
 
$ make -v
 
$ make -v
Line 69: Line 219:
 
<i>Voila!</i>
 
<i>Voila!</i>
  
I also learned from [[User:Sancus|Andrei Hajdukewycz]] 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.
+
I also learned from [[User:Sancus|Sancus]] that you can dump the Make package in your Cygwin packages temp directory and the installer will let you install it (I didn't actually try that). The mirrors don't seem to have properly set up setup.hint files to point to the old versions of the Make files.
 +
 
 +
==Miscellaneous problems and solutions==
 +
I encountered an error code when I tried to build <b>without double-checking if I check-marked all the packages required for the Firefox build during my Cygwin installation</b>. This problem will also occur if you are installing an older version of Cygwin which doesn't have all the packages required for the Firefox build. Here is a sample of the error code:
 +
<pre>
 +
make[2]: Entering directory '/cygdrive/c/proj/mozilla/firefox-objdir/config'
 +
make[3]: Entering directory '/cygdrive/c/proj/mozilla/firefox-objdir/config/mkdepend'
 +
make[3]: Leaving directory '/cygdrive/c/proj/mozilla/firefox-objdir/config/mkdepend'
 +
/usr/bin/perl -I/cygdrive/c/proj/mozilla/config /cygdrive/c/proj/mozilla/config/bdate.pl build_number
 +
make[2]: *** [build_number] Error 255
 +
make[2]: Leaving directory '/cygdrive/c/proj/mozilla/firefox-objdir/config'
 +
make[1]: *** [default] Error 2
 +
make[1]: Leaving directory '/cygdrive/c/proj/mozilla/firefox-objdir'
 +
make: *** [build] Error 2
 +
</pre>
 +
 
 +
I believe this error occurred because the Make build tool couldn't find the Perl package.
 +
 
 +
 
 +
=Minefield Screen Shot=
 +
 
 +
The following is a screen shot of "About Minefield" (Help -> About Minefield):
 +
 
 +
[[Image:Liz_minefield.jpg]]
 +
 
 +
=Contributors=
 +
 
 +
[[User:Sancus|Andrei Hajdukewycz]] (sancus)
 +
: Helped me with placing Make 3.80 in Cygwin
 +
 
 +
[[User:David.humphrey|Dave Humphrey]] (dave)
 +
: Well-documented and concise: [http://cs.senecac.on.ca/%7Edavid.humphrey/writing/firefox-win32-build.html David Humphrey's Guide to Building Firefox on Win32 using Visual Studio .NET 2005]
 +
 
 +
[[User:djhamp-g|David Hamp-Gonsalves]] (inveigle)
 +
: Head start with the <b>first</b> attempt to build Firefox!
  
 
=Resources=
 
=Resources=
 +
I wouldn't have successfully built without the following documentations:
 +
*[http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites Windows Build Prerequisites]
 +
*[http://cs.senecac.on.ca/%7Edavid.humphrey/writing/firefox-win32-build.html David Humphrey's Guide to Building Firefox on Win32 using Visual Studio .NET 2005]
 +
*[http://forums.mozillazine.org/viewtopic.php?t=92495&start=1320&sid=ad7fac8c3bc80a7373a0bf8957a15971 Mozillazine]
 +
*[http://cs.nyu.edu/rgrimm/teaching/fa05-oop/windows-make.html Getting Make to place nice with Cygwin]
 +
* [http://acs.senecac.on.ca ACS]
 +
* [http://www.cygwin.com Cygwin]
 +
* [http://developer.mozilla.org/ Mozilla Developer Center]
 +
* [http://developer.mozilla.org/en/docs/Build_Documentation Mozilla Build Documentation]
 +
 +
 +
If it wasn't for the following people, I wouldn't have my great Firefox built:
 +
*Special thanks to [[User:Sancus|Andrei Hajdukewycz]](sancus) for guiding me through the most difficult part of the build process and helping me have a little more understanding of the Firefox build!!
 +
*[[User:David.humphrey|Dave Humphrey]](dave): Thanks for transferring your Firefox build knowledge. It definitely a great summary to the [http://developer.mozilla.org/en/docs/Build_Documentation Mozilla Build Documentation].
  
 
=Conclusion=
 
=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 [[User:Sancus|Sancus]] in irc://irc.mozilla.org/#seneca who gave me some pointers. The [http://forums.mozillazine.org Mozilla forums] are definitely helpful too, especially when the postings and discussions 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.
 +
 +
 +
<big><b>Lessons learned:</b></big>
 +
 +
You have to start somewhere. By starting means actually <b>doing it</b>! Don't be intimidated. It might seem overwhelming but there are resources to help you go through that phase. Don't ever think that contributing to Mozilla is out of your realm of ability. If there is a will, there is a way!
 +
 +
The Mozilla guys/(girls?) are always there to help you. Get a copy of [http://chatzilla.hacksrus.com/ Chatzilla] or whichever IRC client you prefer and meet them online in these channels irc://irc.mozilla.org/#seneca, irc://irc.mozilla.org/#developers, irc://irc.mozilla.org/#firefox. A start would be outlining your problem in the main of the channel. Be sure to be <b>concise</b> and someone will reply you on the main or in a private chat. However, try solving the problem first before you consult anyone for help.
 +
 +
Don't outsmart anyone who tries to help you. Instead, just listen and consult a few people at the same time to compare which solution is most feasible. As the saying goes, you'll never learn if you don't fail. So maybe failing is sometimes a positive outlook to a problem! Contribute and transfer your knowledge by documenting what you went through with a problem and how you solved it. Making a contribution feels really good, trust me. Don't underestimate your ability, you'll never know till you try it!
 +
 +
And last of all <b>give credits to those who contributed to your project (even if it is trivial)</b>!
 +
 +
Thank you, time for some ice cream now!

Latest revision as of 22:21, 13 April 2009

Submitted by Liz Chak (elichak)

Introduction

I built Firefox on Win32 using Visual Studio .NET 2005. It took me merely 45 minutes to cleanly build Mozilla (dynamic build), but literally the whole night to figure out a problem.

I hope this documentation will help those of you heroes who intend to make an attempt to build Firefox on a Windows XP operating system using Visual Student .NET 2005 as the compiler.

Build Prerequisites

Hardware Requirements

My copy of Mozilla Firefox is built on a system with the following hardware (and it took less than an hour - dynamic build):

  • AMD Sempron Processor 3000+ 1.80 GHz
  • 512 MB of RAM
  • 80 gig Hard Drive
  • 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 {Note: You need your Seneca Learn ID or Mercury ID to access the site).
  • Download Daemon Tools (or google for 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)

Note: Make 3.80 is no longer available in the Cygwin setup installer.


Make 3.80 (Important to avoid problems)

  • 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 (change to the directory cywgin/bin):
$ make -v
GNU Make 3.80

Configuration

Here are the steps that I took to configure the environment for the Firefox build:

Configure the environment

  1. Make a directory for the source and build system:
    $mkdir C:\proj
  2. Make a directory called moztools in C:\proj\
  3. Download and extract the static moztools libraries for Visual C++ to C:\proj\moztools
  4. 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%\bin
    5.  Run the buildsetup.bat script in C:\proj:
$buildsetup.bat
  • To check which program you're running, type which link in the command line after you run the environment variable script (buildsetup.bat) and it will tell you the link:
$which link
$/cygdrive/c/Program Files/Microsfot Visual Studio 8/VC/BIN/link
  • It will be the cygwin or Microsoft link depending on which one you set in the buildsetup.bat


Check out mozilla source

  1. Login to the mozilla CVS repository in C:\proj:
    $cvs login
  2. Type in anonymous as the password when prompted (NOTE: ignore the error message related to .cvspass)
  3. 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 with the filename .mozconfig (filename should be exactly how it's spelt: .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

# I disabled the installer
ac_add_options --disable-installer
  • Note that I have disabled static build, meaning my Firefox will build dynamically:
    ac_add_options --disable-static
    A static build is one that doesn't need external libraries to run. To run a build dynamically, you require all the development libraries and so on installed. A static build takes more time than a dynamic build.
  • Note that I have disabled installer to avoid a problem later:
    ac_add_options --disable-installer

     5.  Get the full source from CVS (By default, you will build HEAD, which is Firefox 3.0):

$cd \proj\mozilla
$make -f client.mk checkout MOZ_CO_PROJECT=browser
     6.  Build the source in C:\proj\mozilla
$make -f client.mk build

The time it takes to build Firefox depends on your machine. It could take as little as 16 minutes or as long as 3 hours! Just be patient and a miracle will happen (unless the console spurts out error code - refer to my list of problems if you encounter any, hopefully it helps).

Your newly built monster, I mean, Firefox will be in C:\proj\mozilla\firefox-objdir\dist\bin. Double click on the executable file that looks like a minefield (and cross your fingers to hope that it wouldn't crash your system).

My first failed attempt to build Firefox 1.8.1

After glancing through the Mozilla Build Documentation, I only needed one word to describe how I felt, overwhelmed! I started by skimming through the text, and downloaded all the required tools, configured the environment, checked out the source before I started my build. I ran into the problem: The linker major version does not match the compiler suite version7

Without researching further on the problem, I consulted one of my classmates and he said that I had to re-install Visual Studio 2003. I was skeptical about his way of resolving this problem (and also it would be a hassle since I've uninstalled it a week before this build), so I looked into it further and found out from Mozillazine that the solution is to install Cygwin.

I tried a new clean build with David Humphrey's Guide to Building Firefox on Win32 using Visual Studio .NET 2005 (very concise and recommended for the heroes who want to build Firefox).


Problems and Solutions

Problem: "To build the installer makensis is required in your path" error

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" error

I found my solution on a forum, Mozillazine. 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!! Windows Build Documentation is updated - 17:15, Sept 16 2006 (EST)

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. It was frustrating, because through most of the forums that discussed about this problem, it seemed like everyone didn't have a problem "rolling back to version 3.80". However, the version of Cygwin that I installed didn't have the older version of Make and I wasn't the only person experiencing that problem at that time. Both my classmate and I tried the various solutions as per my suggestions but they all failed. After several unsuccessful attempts, I consulted Sancus (Andrei Hajdukewycz) for a solution (which was easier than I thought), and the miracle happened, Firefox was then successfully built!! (Sheds a tear of joy..)

Solution to the above "target `c' doesn't match the target pattern" error

  • Install Cywgin from here
  • Download Make 3.80 (Make sure the existing version on your system is cleanly removed all else there will be version conflicts)
  • If that doesn't work then just uninstall make then install version 3.80 from source.
  • 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 (change to the directory cywgin/bin):
$ 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 (I didn't actually try that). The mirrors don't seem to have properly set up setup.hint files to point to the old versions of the Make files.

Miscellaneous problems and solutions

I encountered an error code when I tried to build without double-checking if I check-marked all the packages required for the Firefox build during my Cygwin installation. This problem will also occur if you are installing an older version of Cygwin which doesn't have all the packages required for the Firefox build. Here is a sample of the error code:

make[2]: Entering directory '/cygdrive/c/proj/mozilla/firefox-objdir/config'
make[3]: Entering directory '/cygdrive/c/proj/mozilla/firefox-objdir/config/mkdepend'
make[3]: Leaving directory '/cygdrive/c/proj/mozilla/firefox-objdir/config/mkdepend'
/usr/bin/perl -I/cygdrive/c/proj/mozilla/config /cygdrive/c/proj/mozilla/config/bdate.pl build_number
make[2]: *** [build_number] Error 255
make[2]: Leaving directory '/cygdrive/c/proj/mozilla/firefox-objdir/config'
make[1]: *** [default] Error 2
make[1]: Leaving directory '/cygdrive/c/proj/mozilla/firefox-objdir'
make: *** [build] Error 2

I believe this error occurred because the Make build tool couldn't find the Perl package.


Minefield Screen Shot

The following is a screen shot of "About Minefield" (Help -> About Minefield):

Liz minefield.jpg

Contributors

Andrei Hajdukewycz (sancus)

Helped me with placing Make 3.80 in Cygwin

Dave Humphrey (dave)

Well-documented and concise: David Humphrey's Guide to Building Firefox on Win32 using Visual Studio .NET 2005

David Hamp-Gonsalves (inveigle)

Head start with the first attempt to build Firefox!

Resources

I wouldn't have successfully built without the following documentations:


If it wasn't for the following people, I wouldn't have my great Firefox built:

  • Special thanks to Andrei Hajdukewycz(sancus) for guiding me through the most difficult part of the build process and helping me have a little more understanding of the Firefox build!!
  • Dave Humphrey(dave): Thanks for transferring your Firefox build knowledge. It definitely a great summary to the Mozilla Build Documentation.

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 are definitely helpful too, especially when the postings and discussions 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.


Lessons learned:

You have to start somewhere. By starting means actually doing it! Don't be intimidated. It might seem overwhelming but there are resources to help you go through that phase. Don't ever think that contributing to Mozilla is out of your realm of ability. If there is a will, there is a way!

The Mozilla guys/(girls?) are always there to help you. Get a copy of Chatzilla or whichever IRC client you prefer and meet them online in these channels irc://irc.mozilla.org/#seneca, irc://irc.mozilla.org/#developers, irc://irc.mozilla.org/#firefox. A start would be outlining your problem in the main of the channel. Be sure to be concise and someone will reply you on the main or in a private chat. However, try solving the problem first before you consult anyone for help.

Don't outsmart anyone who tries to help you. Instead, just listen and consult a few people at the same time to compare which solution is most feasible. As the saying goes, you'll never learn if you don't fail. So maybe failing is sometimes a positive outlook to a problem! Contribute and transfer your knowledge by documenting what you went through with a problem and how you solved it. Making a contribution feels really good, trust me. Don't underestimate your ability, you'll never know till you try it!

And last of all give credits to those who contributed to your project (even if it is trivial)!

Thank you, time for some ice cream now!