Open main menu

CDOT Wiki β

Assignment1 (mojo)

Revision as of 05:04, 20 September 2006 by Mattar1 (talk | contribs) (Initial Steps)

Assignment 1 - Build the Fox

Hardware & Software

Processor: Intel Centrino Duo 1.66mhz

Ram: 1 Gigabyte

Operating System: Windows XP SP2

Development Tools: Microsoft Visual Studio 2005 Professional, Cygwin, GNU Make 3.80

Initial Steps

Did the Windows Prerequisities

  1. Install Microsoft Visual Studio 2005 Professional
  2. Install Cygwin
  3. Install Moztools

http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites

Tutorials

I went over a few build tutorials to get an idea of what is going to happen. I used the following links:

http://cs.senecac.on.ca/~david.humphrey/writing/firefox-win32-build.html

http://developer.mozilla.org/en/docs/VC8_Build_Instructions

After getting an idea of the basic process I setup my environment and downloaded the source according to the tutorials.

My setup is as follows:

  • C:\proj
  • C:\proj\moztools
  • C:\cygwin

Add to the Environment Variables %MOZ_TOOLS% = C:\proj\moztools;

I don't like putting libraries or applications in the root directory of C:\, but Cygwin won't work with spaces in the path. I tried to use C:\Program Files\Cygwin, but that failed so I reinstalled it to the root.

Configurations and stuff

filename: cygwin.bat

set HOME=C:\home
set VCVARS=C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat
set MOZ_TOOLS=C:\proj\moztools
set CYGWINBASE=C:\cygwin
set CYGWIN=nodosfilewarning
set PATH=%CYGWINBASE%\bin;%PATH%
call "%VCVARS%"
set PATH=%PATH%;%MOZ_TOOLS%\bin
rem MS-SDK; MSVC; Cygwin; Windows; glib/libIDL; Moztools
rem --- Typically the last thing the script does is launch a cygwin shell
rem --- watch for your ~/.profile and /etc/profile which may overwrite your carefully setup PATH!
bash --login -i

filename: 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

Open a command prompt, go to the project directory (c:\proj) and run buildsetup.bat.

Download the source

In project directory:

cvs login
cvs co mozilla/browser/config mozilla/client.mk

Create the file .mozconfig in proj\mozilla with the following:

filename: .mozconfig

# 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
ac_add_options --disable-installer

Checkout and Build it

make -f client.mk checkout
make -f client.mk build

Run It

After the build is done. Go to: proj\mozilla\firefox-objdir\dist\bin and run firefox.exe.

 

Problems on the way

First problem I encountered was some configuration problems. I needed to modify them to use work with my environemnt. I remember changing .mozconfig, buildsetup.bat, and cygwin.bat to get this error to go away, but not sure which one actually fixed the issue:

 

This error occurred when I was using bash rather than cmd. I switched to cmd after my fascination with bash running on windows was over.

Second problem was the Make version. I used the cygwin version, but reading from Liz's problems I found I needed to install 3.80 rather than using 3.81. That cleared it up.

Third problem was after the build worked I ran the program but it would load my current installed version of firefox 1.5.0.7. I remember somebody talking about this on IRC, but I didn't pay attention. The important thing is somebody else had this issue which probably means my build worked. I tried running it as another user, right click Run As..., and a command prompt and window appeared, but I started to get lots of error prompts. This might have something to do with me changing make versions without removing the old objects. I was too lazy to start building again, so I kept hitting Ignore.

 

Finally Minefield came up.

My Build Screenshot

 

My Thoughts

I found building firefox from source had more problems than my previous experiences. I have built bsd kernels through a similar process and building binaries for *nix. Even thought I built firefox I am not happy with the errors I got. I don't have time tonight to keep building until I got it the way I liked. I found it interesting running *nix tools in Windows, but still prefer the real thing. Overall, it was a good experience. Running into problems teaches you more than you may want to, but it is valuable to have gone through it.