Friday, November 16, 2007

Week 3: Managing and Building Large Source Trees

Debug Mozilla Build

I was not able to do a debug build of Firefox on my home PC because it did not meet the necessary hardware requirements for a Windows Build that are listed at the mozilla developer center's web site. However, I was able to obtain a small, but powerful laptop through my instructor for OSD600 and the Office of Research and Innovation (ORI) at Seneca College. The laptop is a Dell XPS M1210 with an Intel Core 2 2.0 GHz CPU, 1 GB of RAM and a 150 GB hard drive. This laptop had a somewhat buggy installation of Windows XP Professional on it that seemed to be related to Windows Explorer.

In order to do the build in Windows XP Pro, I installed Microsoft's Visual Studio 2005 as part of the Software Requirements and the Mozilla Build 1.1 Package, which contains all the other software prerequisites necessary for building Mozilla. I carefully followed the instructions to checkout the latest Firefox source using CVS and the instructions to build Mozilla according to the Mozilla Developer Center (MDC). However, when I tried using the make command to checkout and build Firefox, a sh.exe.stackdump file was generated with a STATUS_ACCESS_VIOLATION exception that appeared to be related to MSYS. This occurred on several attempts to build Firefox. I did not retain a copy of the file, otherwise I would display its contents here.

Hats off to Fedora 7!

After a number of unsuccessful attempts to build Firefox in Windows XP Pro and not knowing how to solve the problem with MSYS generating a sh.exe.stackdump STATUS_ACCESS_VIOLATION exception, I decided to try an alternate build platform, Fedora 7. I received assistance from my instructor, Chris Tyler, to partition my hard drive using a copy of GParted-LiveCD. Firstly, I tried installing the 32-bit Live CD version of Fedora 7 but there were problems with the installation so Chris installed the Fedora 7 Live x86_64 version instead. Everything appeared to be alright with this installation of Fedora 7 but I received error messages again when I tried to build Firefox.

Eventually, out of frustration I decided to download, burn and install the full Fedora 7 x86_64 DVD version for 64-bit PCs. Again, I followed the checkout and build instructions for a debug build of Firefox and this time the build was successful. Below are the contents of my .mozconfig file and the build details for Firefox (Minefield):

.mozconfig
#
# See http://www.mozilla.org/build/ for build instructions.
#
# Options for client.mk.
mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-debug
mk_add_options MOZ_MAKE_FLAGS=-j4

# Options for 'configure' (same as command-line options).
ac_add_options --enable-application=browser
ac_add_options --enable-pango

# Debug options for 'configure'
ac_add_options --enable-debug
ac_add_options --disable-optimize

about:
Copyright © 1998-2007 by contributors to the Mozilla Project.
Read the licensing information for this product.
Read the release notes for this version.
See the build configuration used for this version.
Build identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9b2pre) Gecko/2007111515 Minefield/3.0b2pre

about:buildconfig

Build platform

target
x86_64-unknown-linux-gnu

Build-tools

Compiler
gcc
Version
gcc version 4.1.2 20070925 (Red Hat 4.1.2-27)
Compiler flags
-Wall -W -Wno-unused -Wpointer-arith -Wcast-align -Wno-long-long -pedantic -pthread -pipe

Compiler
c++
Compiler
gcc version 4.1.2 20070925 (Red Hat 4.1.2-27)
Compiler flags
-fno-rtti -fno-exceptions -Wall -Wconversion -Wpointer-arith -Wcast-align -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wno-long-long -pedantic -fshort-wchar -pthread -pipe

Configure arguments
--enable-application=browser --enable-pango --enable-debug --disable-optimize

The elapsed times for the debug build of Firefox on Fedora 7 x86_64 are shown below:

real 18m 40.126s

user 15m 15.208s

sys 3m 8.559s

Back to Windows XP Professional

I was dissatisfied with my earlier unsuccessful attempts to build Firefox on Windows XP Pro so I decided to do a clean installation of the operating system and Visual Studio 2005. However, again I was unsuccessful at building Firefox and a sh.exe.stackdump file with a STATUS_ACCESS_VIOLATION exception was still being generated. Finally, I decided to do a Google search for this exception and I found some helpful information at the following web site:

http://www.mingw.org/MinGWiki/index.php/FAQ


Why does make often crash creating a sh.exe.stackdump file when I try to compile my source code?
If you experience random crashes with make as well as with the msysinfo command
(i.e., repeating the command often allows to compile the source code succesfully), the issue might be caused by the Logitech QuickCam software. Here is provided a solution to this issue:
type the command services.msc from a command prompt (you will need administrator privileges to do this), then find the "Logitech Process Monitor" service, and change the "Startup type" from "Auto" to "Manual". Do the same with the "LVSrvLauncher" service. type the command regedit from the command prompt (you will need administrator privileges
to do this), then find the key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run. Among the other REG_SZ keys, there should be three of them related to the Logitech QuickCam, namely: "LogitechCommunicationsManager", "LogitechQuickCamRibbon", "LVCOMSX". Make a backup of the registry, then remove them.
reboot your PC
In this way the Logitech QuickCam deamon won't be available anymore. Nonetheless, the camera will keep working just ok with 3rd party software (e.g., Skype). If you want a less drastic solution, just kill the lvprcsrv.exe process whenever you want to use MSYS by typing at the command prompt: pskill -t lvprcsrv.exe (you will need PsTools and administrator privileges to do this). However, as soon as you will plug in the USB cable of your Logitech QuickCam, the deamon will be restarted, while with the first procedure it won't.

The laptop computer that I've been using for the builds has a built-in web cam and a Logitech QuickCam driver and software installed on it. Using this new information, I decided to uninstall the Logitech QuickCam driver and software. After doing this, I followed the checkout and build instructions for a debug build of Firefox and this time the build was successful. Below are the contents of my .mozconfig file and the about: details for Firefox (Minefield):

.mozconfig file
#
# See http://www.mozilla.org/build/ for build instructions.
#
# Options for client.mk.
mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-debug
mk_add_options MOZ_MAKE_FLAGS=-j4

# Options for 'configure' (same as command-line options).
ac_add_options --enable-application=browser

# Debug options for 'configure'
ac_add_options --enable-debug
ac_add_options --disable-optimize


about:
Copyright © 1998-2007 by contributors to the Mozilla Project.
Read the licensing information for this product.
Read the release notes for this version.
See the build configuration used for this version.
Build identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2pre) Gecko/2007111512 Minefield/3.0b2pre

about:buildconfig

Build platform

target
i686-pc-mingw32

Build tools
Compiler

cl
Version
14.00.50727
Compiler flags
-TC -nologo -W3 -Gy -Fd$(PDBFILE)

Compiler
cl
Version
14.00.50727
Compiler flags
-GR- -TP -nologo -Zc:wchar_t- -W3 -Gy -Fd$(PDBFILE)

Configure arguments

--enable-application=browser --enable-debug --disable-optimize


The elapsed times for the debug build of Firefox on Windows XP are shown below:

real 38m 47.610s
user 13m 6.165s
sys 9m 26.050s

2 comments:

Unknown said...

Thanks, Kerry, for tracking down the problem with the laptop builds!

Unknown said...

Logitech!? Kerry, thanks for figuring this out! It was driving me crazy.