Difference between revisions of "Building Firefox 1.5"

From CDOT Wiki
Jump to: navigation, search
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
= Assignment 1 - Building the Fox =
+
= Building The Fox - 1.8.0 Branch =
  
Written By [[user:RealMarkP|Mark Paruzel]].<br/>
+
Written By [[user:RealMarkP|Mark Paruzel]].
''THIS IS UNDER CONSTRUCTION!!''
 
  
 
== Introduction ==
 
== Introduction ==
  
I have built [[Assignment_1_(mcparuze)|Firefox before]] for a previous assignment I did and it was dead simple. Building Firefox 3.0 is as easy as riding a bike; building Firefox 1.5 is like attempting to start a fire, 30 feet under water. Its painful. So, hopefully these instructions will make it a bit easier then the instructions available on the MDC.
+
I have built [[Assignment_1_(mcparuze)|Firefox before]] for a previous assignment I did and it was dead simple. Building Firefox 3.0 is as easy as riding a bike; building Firefox 1.5 is like attempting to start a fire, 30 feet under water. It’s painful. So, hopefully these instructions will make it a bit easier then the instructions available on the MDC.
  
 
== Required Software ==
 
== Required Software ==
Line 24: Line 23:
 
=== Cygwin ===
 
=== Cygwin ===
  
* Cygwin is avilable for download [ftp://ftp.osuosl.org/pub/cygwin/setup.exe Here]. Install it with the following tools:
+
* Cygwin is available for download [ftp://ftp.osuosl.org/pub/cygwin/setup.exe Here]. Install it with the following tools:
 
**  ash -- UNIX-like command line interpreter shell (Base category)
 
**  ash -- UNIX-like command line interpreter shell (Base category)
 
** coreutils -- GNU core utilities (includes fileutils, sh-utils, and textutils) (Base category)
 
** coreutils -- GNU core utilities (includes fileutils, sh-utils, and textutils) (Base category)
 
** diffutils -- file comparison utility (Base category)
 
** diffutils -- file comparison utility (Base category)
 
** findutils (Base category)
 
** findutils (Base category)
** gawk -- pattern matching language (Base and Interpretors categories)
+
** gawk -- pattern matching language (Base and Interpreters categories)
 
** grep -- text search tool (Base category)
 
** grep -- text search tool (Base category)
 
** make -- dependency analyzer for software builds (Devel category)
 
** make -- dependency analyzer for software builds (Devel category)
Line 40: Line 39:
 
=== Make 3.80 ===
 
=== Make 3.80 ===
  
* Unfortunately, Cygwin no longer is bundled with make 3.80, rather its bundled with 3.81-1 which breaks duing the Firefox build.  
+
* Unfortunately, Cygwin no longer is bundled with make 3.80, rather its bundled with 3.81-1 which breaks during the Firefox build.  
 
* To get the version of make that works (3.80), you have to download it [http://cygwin.paracoda.com/release/make/make-3.80-1.tar.bz2 here]. Once you have download it, you can just grab the Make executable file (make.exe) from /usr/bin/ directory and drop it into Cywgin/bin (this will overwrite the existing Make executable).
 
* To get the version of make that works (3.80), you have to download it [http://cygwin.paracoda.com/release/make/make-3.80-1.tar.bz2 here]. Once you have download it, you can just grab the Make executable file (make.exe) from /usr/bin/ directory and drop it into Cywgin/bin (this will overwrite the existing Make executable).
 
* While your doing this, make sure Cygwin is not running. If it is, you will need to restart Cygwin.
 
* While your doing this, make sure Cygwin is not running. If it is, you will need to restart Cygwin.
Line 68: Line 67:
  
 
* There are two tool packages that are required to build Firefox using VS 7.1. These two tools are called [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/moztools-static.zip Moztools] and [http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip Wintools].
 
* There are two tool packages that are required to build Firefox using VS 7.1. These two tools are called [http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/moztools-static.zip Moztools] and [http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip Wintools].
* Download these two zip files and extract thier contents into your C:\proj\ directory.
+
* Download these two zip files and extract their contents into your C:\proj\ directory.
 
<pre>
 
<pre>
 
$> pwd
 
$> pwd
Line 115: Line 114:
 
rem --- moztools comes last after glib/libIDL
 
rem --- moztools comes last after glib/libIDL
 
SET PATH=%GLIB_PREFIX%;%GLIB_PREFIX%\bin;%PATH%;%MOZ_TOOLS%\bin
 
SET PATH=%GLIB_PREFIX%;%GLIB_PREFIX%\bin;%PATH%;%MOZ_TOOLS%\bin
 +
SET MOZCONFIG=C:\proj\mozilla\mozconfig
 
</pre>
 
</pre>
 
* It should be noted that there are several lines that point to C:\proj\VC71, this is alright because we will install those in the enxt section.
 
* It should be noted that there are several lines that point to C:\proj\VC71, this is alright because we will install those in the enxt section.
Line 137: Line 137:
 
=== Environment Variables ===
 
=== Environment Variables ===
  
* The first thing that needs to be done, is to jump into the DOS command prompt.
+
* The first thing that needs to be done is to jump into the DOS command prompt.
 
<pre>
 
<pre>
 
$> cmd.exe
 
$> cmd.exe
 
C:\proj>
 
C:\proj>
 
</pre>
 
</pre>
* Note: All the unix commands work perfectly in this state because the DOS command prompt inherited all the environment settings of the Cygwin shell.
+
* Note: All the Unix commands work perfectly in this state because the DOS command prompt inherited all the environment settings of the Cygwin shell.
* In order to install winTools into the Moztools, we need to navigate into that directory and install using the batch file provided.
+
* Firstly, we need to run the buildsetup batch file we created earlier in order to set up any environment variables we need.
<pre>
 
C:\proj>cd buildtools
 
C:\proj\buildtools>cd windows
 
C:\proj\buildtools\windows>install.bat
 
 
 
MOZ_TOOLS is set to C:\proj\moztools
 
 
 
copying exes and dlls to C:\proj\moztools\bin
 
copying include files to C:\proj\moztools\include
 
copying include files to C:\proj\moztools\include\libIDL
 
copying lib files to C:\proj\moztools\lib
 
 
 
done copying
 
 
 
make sure that MOZ_TOOLS\bin is on your path
 
 
 
C:\proj\buildtools\windows>cd ../..
 
C:\proj>
 
</pre>
 
* This copies over any windows related tools that we need for the build.
 
* Secondly, we need to run the builsetup batch file we created earlier in order to set up any environment variables we need.
 
 
<pre>
 
<pre>
 
C:\proj>buildsetup.bat
 
C:\proj>buildsetup.bat
Line 180: Line 159:
 
Studio .NET 2003\SDK\v1.1\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\cygwin\bin;C:\;C:\windows\system32;C:\windows\system32\wbem;;c:\proj\vc71;c:\proj\vc71\bin;C:\proj\moztools\bin
 
Studio .NET 2003\SDK\v1.1\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\cygwin\bin;C:\;C:\windows\system32;C:\windows\system32\wbem;;c:\proj\vc71;c:\proj\vc71\bin;C:\proj\moztools\bin
 
</pre>
 
</pre>
* What you should be looking for is the if C:\proj\vc71 is in the path as well as C:\proj\moztools. These two paths are crucial to the build.
+
* What you should be looking for is if the C:\proj\vc71 is in the path as well as C:\proj\moztools. These two paths are crucial to the build.
 
<pre>
 
<pre>
 
C:\proj>echo %GLIB_PREFIX%
 
C:\proj>echo %GLIB_PREFIX%
Line 190: Line 169:
 
C:\proj>echo %MOZ_TOOLS%
 
C:\proj>echo %MOZ_TOOLS%
 
C:\proj\moztools
 
C:\proj\moztools
 +
 +
C:\proj>echo %MOZCONFIG%
 +
C:\proj\mozilla\mozconfig
  
 
C:\proj>
 
C:\proj>
 
</pre>
 
</pre>
*  
+
* Secondly, in order to install Wintools into the Moztools, we need to navigate into that directory and install using the batch file provided.
 +
<pre>
 +
C:\proj>cd buildtools
 +
C:\proj\buildtools>cd windows
 +
C:\proj\buildtools\windows>install.bat
 +
 
 +
MOZ_TOOLS is set to C:\proj\moztools
 +
 
 +
copying exes and dlls to C:\proj\moztools\bin
 +
copying include files to C:\proj\moztools\include
 +
copying include files to C:\proj\moztools\include\libIDL
 +
copying lib files to C:\proj\moztools\lib
 +
 
 +
done copying
 +
 
 +
make sure that MOZ_TOOLS\bin is on your path
 +
 
 +
C:\proj\buildtools\windows>cd ../..
 +
C:\proj>
 +
</pre>
 +
* This copies over any windows related tools that we need for the build.
 +
* The environment is now set up to receive and compile the Mozilla source tree.
  
 
=== Pulling From CVS ===
 
=== Pulling From CVS ===
 +
 +
* Now the easy part begins. In order to pull from the CVS repository, you have to specify the right type of branch to pull, this is done by the following command.
 +
<pre>
 +
C:\proj>cvs -d :pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot co -r MOZILLA_1_8_0_BRANCH mozilla/client.mk
 +
</pre>
 +
* We are going to pull the 1.8.0 branch because that’s the branch that corresponds with the Firefox 1.5 build.
 +
* This creates a Mozilla directory with a file called client.mk inside it. This file is a make file script that defines what to pull and how.
 +
* To pull the source from the CVS, just use this command.
 +
<pre>
 +
C:\proj>cd mozilla
 +
C:\proj\mozilla>make -f client.mk checkout
 +
</pre>
 +
* Once its done, we need to make a file called mozconfig that will specify the parts of the system that will be built. Put the following code inside this file using notepad or similar text processor. This file does not have an extension and is plainly called mozconfig.
 +
<pre>
 +
mk_add_options MOZ_CO_PROJECT=browser
 +
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/hopefullyWorked.firefox.optimized
 +
ac_add_options --enable-application=browser
 +
ac_add_options --disable-optimize
 +
ac_add_options --enable-debug
 +
ac_add_options --enable-svg
 +
ac_add_options --enable-canvas
 +
ac_add_options --disable-installer
 +
</pre>
 +
* Next, all we have to do is Build!!
  
 
=== Building ===
 
=== Building ===
 +
 +
* Its time to build this beast!
 +
<pre>
 +
C:\proj\mozilla>make -f client.mk build
 +
</pre>
 +
 +
* Wait...
 +
* ....Wait some more...
 +
* ...........Keep waiting............
 +
* Somewhere within about 2 hours, the code will finish compiling and you should have Firefox.exe sitting inside your C:\proj\mozilla\hopefullyWorked.firefox.optimized\dist\bin directory.
 +
* Were done!!!
  
 
== Problems Encountered & Solutions ==
 
== Problems Encountered & Solutions ==
Line 203: Line 241:
 
=== xpidl.exe Crashes ===
 
=== xpidl.exe Crashes ===
  
 
+
* This is because your Path enironment veariable points to the wrong version of Glib and LibIDL. check your path and make sure that it points to C:\proj\vc71 and C:\proj\Vc71\bin. These two Path entries should be at the begining of your Path variable.
  
 
== Resources Used ==
 
== Resources Used ==

Latest revision as of 11:25, 14 October 2006

Building The Fox - 1.8.0 Branch

Written By Mark Paruzel.

Introduction

I have built Firefox before for a previous assignment I did and it was dead simple. Building Firefox 3.0 is as easy as riding a bike; building Firefox 1.5 is like attempting to start a fire, 30 feet under water. It’s painful. So, hopefully these instructions will make it a bit easier then the instructions available on the MDC.

Required Software

  1. Microsoft Visual Studio 2003 (MSVC 7.1)
  2. Cygwin
  3. Make 3.80 for Cygwin
  4. Moztools & Wintools
  5. Patience!!!

Build Instructions

Visual Studio 2003

  • Visual Studio is available at the school ACS office/website so you can grab it from there and install it. Its easy to install it because the installer is idiot proof. This shouldn't be hard :).

Cygwin

  • Cygwin is available for download Here. Install it with the following tools:
    • ash -- UNIX-like command line interpreter shell (Base category)
    • coreutils -- GNU core utilities (includes fileutils, sh-utils, and textutils) (Base category)
    • diffutils -- file comparison utility (Base category)
    • findutils (Base category)
    • gawk -- pattern matching language (Base and Interpreters categories)
    • grep -- text search tool (Base category)
    • make -- 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)

Make 3.80

  • Unfortunately, Cygwin no longer is bundled with make 3.80, rather its bundled with 3.81-1 which breaks during the Firefox build.
  • To get the version of make that works (3.80), you have to download it here. Once you have download it, you can just grab the Make executable file (make.exe) from /usr/bin/ directory and drop it into Cywgin/bin (this will overwrite the existing Make executable).
  • While your doing this, make sure Cygwin is not running. If it is, you will need to restart Cygwin.

Setting Up Your Build Directory

  • Start up Cygwin and navigate to your C drive:
$> cd /cygdrive/c/
$> pwd
/cygdrive/c
  • We need to create a place where we will do all our development. I used a directory called proj:
$> mkdir proj
$> cd proj
$> pwd
/cygdrive/c/proj
  • Inside this directory, we will put all of our tools and batch files we will use to setup the build environment:
$> touch buildsetup.bat
  • The buildsetup.bat will set up the environment variables for us, which we will do in a different section.

Moztools And Wintools

  • There are two tool packages that are required to build Firefox using VS 7.1. These two tools are called Moztools and Wintools.
  • Download these two zip files and extract their contents into your C:\proj\ directory.
$> pwd
/cygdrive/c/proj
$> ls -al
drwx------+  6 RealMarkP       None         0 Oct 12 15:13 .
drwxrwxr-x+ 10 Administrators  SYSTEM       0 Oct 13 11:23 ..
-rwx------+  1 RealMarkP       None       843 Oct 12 15:08 buildsetup.bat
drwx------+  5 RealMarkP       None         0 Jan 23  2001 buildtools
drwx------+  5 RealMarkP       None         0 Jan 24  2006 moztools
  • At this point were technically done with this section, installing these two tools will be handled in a later section.

Setting Up The Environment

  • The Cygwin Environment is basically set up and the two tool packages are extracted. You now have the tools required to automate the build process as well as the compiler to do the grunt work.
  • Before you can start to build, you need to set up a bunch of environment variables so that the make files know where to look for dependencies. I created a build batch file that set up the environment for me:
@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 librariesset
set MOZ_TOOLS=C:\proj\moztools
set GLIB_PREFIX=c:\proj\vc71
set LIBIDL_PREFIX=c:\proj\vc71

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 .NET 2003\Vc7\bin\vcvars32.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=%GLIB_PREFIX%;%GLIB_PREFIX%\bin;%PATH%;%MOZ_TOOLS%\bin
SET MOZCONFIG=C:\proj\mozilla\mozconfig
  • It should be noted that there are several lines that point to C:\proj\VC71, this is alright because we will install those in the enxt section.

Glib And LibIDL For VC 7.1

  • Unfortunately, Moztools cones with an out dated version of Glib and LibIDL, therefore we have to supply our own. The following versions of Glib and libIDL are for Visual Studio 7.1.
  • Grab these two files and extract them into the proj directory. If done correctly they should be a directory called VC71 in your C:\proj directory.
$> pwd
/cygdrive/c/proj
$> ls -al
drwx------+  6 RealMarkP       None         0 Oct 12 15:13 .
drwxrwxr-x+ 10 Administrators  SYSTEM       0 Oct 13 11:23 ..
-rwx------+  1 RealMarkP       None       843 Oct 12 15:08 buildsetup.bat
drwx------+  5 RealMarkP       None         0 Jan 23  2001 buildtools
drwx------+  5 RealMarkP       None         0 Jan 24  2006 moztools
drwx------+  6 RealMarkP       None         0 Apr  5  2004 vc71
  • At this point, you are ready to set up the environment variables so that the build process knows where to look.

Environment Variables

  • The first thing that needs to be done is to jump into the DOS command prompt.
$> cmd.exe
C:\proj>
  • Note: All the Unix commands work perfectly in this state because the DOS command prompt inherited all the environment settings of the Cygwin shell.
  • Firstly, we need to run the buildsetup batch file we created earlier in order to set up any environment variables we need.
C:\proj>buildsetup.bat
Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)

C:\proj>
  • In order to test and see if this worked, you can display all the variables that were changed and see if they contain the necessary paths for the build to work.
C:\proj>echo %PATH%
c:\proj\vc71;c:\proj\vc71\bin;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET 20
03\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin\prerelease;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin;C:\Program Files\Microsoft Visual
Studio .NET 2003\SDK\v1.1\bin;C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322;C:\cygwin\bin;C:\;C:\windows\system32;C:\windows\system32\wbem;;c:\proj\vc71;c:\proj\vc71\bin;C:\proj\moztools\bin
  • What you should be looking for is if the C:\proj\vc71 is in the path as well as C:\proj\moztools. These two paths are crucial to the build.
C:\proj>echo %GLIB_PREFIX%
c:\proj\vc71

C:\proj>echo %LIBIDL_PREFIX%
c:\proj\vc71

C:\proj>echo %MOZ_TOOLS%
C:\proj\moztools

C:\proj>echo %MOZCONFIG%
C:\proj\mozilla\mozconfig

C:\proj>
  • Secondly, in order to install Wintools into the Moztools, we need to navigate into that directory and install using the batch file provided.
C:\proj>cd buildtools
C:\proj\buildtools>cd windows
C:\proj\buildtools\windows>install.bat

MOZ_TOOLS is set to C:\proj\moztools

copying exes and dlls to C:\proj\moztools\bin
copying include files to C:\proj\moztools\include
copying include files to C:\proj\moztools\include\libIDL
copying lib files to C:\proj\moztools\lib

done copying

make sure that MOZ_TOOLS\bin is on your path

C:\proj\buildtools\windows>cd ../..
C:\proj>
  • This copies over any windows related tools that we need for the build.
  • The environment is now set up to receive and compile the Mozilla source tree.

Pulling From CVS

  • Now the easy part begins. In order to pull from the CVS repository, you have to specify the right type of branch to pull, this is done by the following command.
C:\proj>cvs -d :pserver:anonymous:anonymous@cvs-mirror.mozilla.org:/cvsroot co -r MOZILLA_1_8_0_BRANCH mozilla/client.mk
  • We are going to pull the 1.8.0 branch because that’s the branch that corresponds with the Firefox 1.5 build.
  • This creates a Mozilla directory with a file called client.mk inside it. This file is a make file script that defines what to pull and how.
  • To pull the source from the CVS, just use this command.
C:\proj>cd mozilla
C:\proj\mozilla>make -f client.mk checkout
  • Once its done, we need to make a file called mozconfig that will specify the parts of the system that will be built. Put the following code inside this file using notepad or similar text processor. This file does not have an extension and is plainly called mozconfig.
mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/hopefullyWorked.firefox.optimized
ac_add_options --enable-application=browser
ac_add_options --disable-optimize
ac_add_options --enable-debug
ac_add_options --enable-svg
ac_add_options --enable-canvas
ac_add_options --disable-installer
  • Next, all we have to do is Build!!

Building

  • Its time to build this beast!
C:\proj\mozilla>make -f client.mk build
  • Wait...
  • ....Wait some more...
  • ...........Keep waiting............
  • Somewhere within about 2 hours, the code will finish compiling and you should have Firefox.exe sitting inside your C:\proj\mozilla\hopefullyWorked.firefox.optimized\dist\bin directory.
  • Were done!!!

Problems Encountered & Solutions

xpidl.exe Crashes

  • This is because your Path enironment veariable points to the wrong version of Glib and LibIDL. check your path and make sure that it points to C:\proj\vc71 and C:\proj\Vc71\bin. These two Path entries should be at the begining of your Path variable.

Resources Used

Conclusion

It took me almost a week to figure out what to pull from CVS, setting up the environment variables, build, finding what i did wrong and rebuilding 6 more times...In other words, it was a pain. Fortunately, Firefox got built so now I can get on with trying to run it through the VS Debugger.