Difference between revisions of "Assignment 1 (pstdenis)"
m (→Problems Encountered)
|Line 104:||Line 104:|
The second problem I ran into was after the build script had been running for almost 2 hours. The error was --Error 2: File
The second problem I ran into was after the build script had been running for almost 2 hours. The error was --Error 2: File MUI.nshwas not found.-- Using Google, I traced the file 'MUI.nsh' back to NSIS. I checked the NSIS include folder and did not find it there. I remembered that during the install of NSIS I did not check to install the developer tools along with the program. A quick reinstall solved the issue and build was restarted.
== Resources ==
== Resources ==
Revision as of 19:16, 20 September 2006
As the first assignment for DPS909 – Topics in Open Source Development, I was given the task of building one of the largest open source projects from its code base.
Steps to complete the build
For me, when I hear about an open source project, the first thing that came to mind was “Terrible documentation”. This first assignment “forced” me to use the online documentation for the Firefox web browser. While chatting on IRC in the #seneca channel and talking to classmates in and out of class, I’ve learnt that the documentation on the Mozilla Developer Center (MDC) has been greatly improved recently. I took everyone’s word on the subject and attempted to rely solely on the build documentation found in the MDC's Build Documentation.
I know from previous experience with trying to follow a program’s documentation that if you divert away from the steps mentioned, the chance that there will be a problem in the final stages becomes higher because a small yet important step may have been overlooked. I followed the build documentation word per word and tried my best to not lose my place in the process. I got through the software requirements section without any problems which brings me to the first step of the build process.
Install Required Software
- The first thing I needed was a C compiler. The compiler recommended by Mozilla is the C++ compiler that is part of Microsoft’s Visual Studio 2005. I retrieved a copy of Visual Studio 2005 from Seneca’s ACS department web site and installed the Visual C++ 2005 section.
- The second required item is the GNU Tools for Microsoft Windows (Cygwin). Cygwin is used to setup a Linux-like environment for Windows and provide Linux tools for development. The tools I installed through Cygwin were: ash, coreutils, cvs, diffutils, findutils, gawk, grep, libiconv, make, patchutils, perl, sed, unzip and zip.
- The third element I needed to install was the Nullsoft Scriptable Install System (NSIS) which is used to package the install system which Firefox uses.
- Before continuing, the last package needed is the moztools package which includes binaries and libraries necessary to build any Mozilla application. It was simply downloading a .zip file and extracting it to the proper location.
Configuring the Environment
Before using Cygwin I needed to change the DOS batch script that is executed when starting Cygwin. I copied the sample batch script from MDC and changed the values to match my directory structure.
set HOME=C:\ffbuild\Cygwin\home set VCVARS=C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat set MOZ_TOOLS=C:\ffbuild\moztools set CYGWINBASE=C:\ffbuild\cygwin set CYGWIN=nodosfilewarning set PATH=%CYGWINBASE%\bin;%PATH% call "%VCVARS%" set PATH=%PATH%;%MOZ_TOOLS%\bin 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
Getting the Source
The next step was to start Cygwin and get the Firefox source code. To do so, I ran the following three commands in the Cygwin command window.
cvs -d :pserver:anonymous:email@example.com:/cvsroot co mozilla/client.mk cd mozilla make -f client.mk checkout MOZ_CO_PROJECT=browser
Those lines downloaded all the Firefox source code in its proper tree structure onto my computer.
Configuring Build Options
By this time I was getting tired. I skipped most of the Configuring Build Options section on MDC. I skipped straight to the example .mozconfig section and copied the Firefox example.
. $topsrcdir/browser/config/mozconfig mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-opt-static ac_add_options --enable-optimize ac_add_options --disable-debug ac_add_options --enable-static ac_add_options --disable-shared ac_add_options --disable-tests mk_add_options MOZ_CO_PROJECT=browser
After a few hours of installing the necessary software and configuring the environment to perform the build it was time to start the three hour, CPU melting (in my case) build process. To do so I executed the following command at the Cygwin command prompt.
make -f client.mk build
The first step of the build checks if your system has the appropriate files and configuration on your system. The first problem I encountered was that the configuration was not being read properly. Almost instantaneously I was getting the error:
configure: error: --enable-application=APP is required
even though I had the line:
option in my .mozconfig.
I reviewed the Build Documentation to make sure I had it in the correct location, which I did. Using Google didn’t really help as everyone’s response was "Follow the Build Documentation at http://developer.mozilla.org/en/docs/Build_Documentation." To finally solve this I had to change the way I built the code. At first I was using the Cygwin command prompt then I decided to try to follow the build documentation found on David Humphrey’s site. The only items that I changed were the environment batch that had to be run and the fact that I was using a DOS command prompt instead of the default Cygwin prompt. I copied the downloaded source and changed the batch to:
@echo off SET CVSROOT=:pserver:firstname.lastname@example.org:/cvsroot SET CVS_RSH=ssh set MOZ_TOOLS=C:\proj\moztools set GLIB_PREFIX=%MOZ_TOOLS% set LIBIDL_PREFIX=%MOZ_TOOLS% SET INCLUDE= SET LIB= SET PATH=C:\;C:\windows\system32;C:\windows\system32\wbem SET PATH=C:\proj\software\cygwin\bin;%PATH% CALL "C:\Program Files\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86 SET PATH=%PATH%;%GLIB_PREFIX%;%GLIB_PREFIX%\bin SET INCLUDE=%GLIB_PREFIX%\include;%INCLUDE% SET LIB=%GLIB_PREFIX%\lib;%LIB% SET PATH=%PATH%;%MOZ_TOOLS%\bin SET NSIS=C:\Program Files\NSIS SET PATH=%PATH%;%NSIS%
The second problem I ran into was after the build script had been running for almost 2 hours. The error was --Error 2: File "MUI.nsh" was not found.-- Using Google, I traced the file 'MUI.nsh' back to NSIS. I checked the NSIS include folder and did not find it there. I remembered that during the install of NSIS I did not check to install the developer tools along with the program. A quick reinstall solved the issue and build was restarted.
- Mozilla Developer Center Build Documentation
- ACS :: Academic Computing Systems
- GNU Tools for Microsoft Windows (Cygwin)
- Nullsoft Scriptable Install System (NSIS)
- Building Firefox on Win32 using Visual Studio .NET 2005
Build of Firefox 3 (Minefield) from September 10th, 2006
The practice of building Firefox is something that I will definitely mention in future employment interviews and to brag about in forums around the internet. Before this experience, the largest program I have compiled is one of my assignments which took a whole 20 seconds to compile. The 3 hour build is definitely something I won’t forget. One of the greatest things about building Firefox is the interaction with the community which helped me to get started and pointed me in the right direction. I will be looking forward to giving back to the community in the future.