mozdev.org

citations

resources:
Mozilla Build on WIN32 My HOW-TO
BUILDING MOZILLA ON WIN32 WITH CYGWIN MINI HOWTO

This document reports how I built Mozilla on Win32 using the GNU compilers. I hope it can be of some help for you. THIS IS NOT AN OFFICIAL GUIDE NOR THE INFORMATION CONTAINED HERE ARE SUPPORTED OR ENDORSED BY THE MOZILLA FOUNDATION

INTRODUCTION
My objective was to build Mozilla version 1.7.3 with cygwin. I decided to write this HOWTO because this task  has revealed to be really difficult  (I performed the same task on Linux with no trouble).
The main information source I used to perform the build is http://www.mozilla.org/build/win32.html, so this document could be a mere repetition of information already available there but here I expose the step-by-step what I did to get the build done.

HARDWARE
The builder machine is the notebook Toshiba Portege 3500 with 512MB RAM, 1.33GHz CPU, and 4GB free disk. I strongly suggest to have at least 4GB free, in fact the build used more than 3GB in my disk (this amount could change depending on how you file system is fragmented). This is for the (default) full debug build. An optimized build only needs ¼ of that space.


SOFTWARE
Windows XP Tablet Edition
CygWin 1.5.11


GETTING THE CODE
I got the code of Mozilla version 1.7.3 from http://www.mozilla.org/download-mozilla.html
I downloaded the bzipped2 tarball because is more compact. Then I created a new folder in my Win machine

C:\mozilla-src-1.7.3

GETTING CYGWIN
To extract the files from the archive I used the cygwin shell (so if you don't have cygwin installed on your machine I strongly suggest to install it from http://www.cygwin.com/. It is compulsory to go on with this build)
I installed cygwin in:

C:\cygwin1.5.11

Opening the cygwin shell you have a Unix view of the filesystem:  for instance, the file 
C:\cygwin1.5.11\home\davide\foo
is viewed in the shell as (notice the slashes)
/home/davide/foo
Any path outside the cygwin root can be referenced too because the Windows directory
C:\ 
is mapped in cygwin as
/cygdrive/c
Thus the installation directory of my codebase
C:\mozilla-src-1.7.3
is visible in the cygwin shell under
/cygdrive/c/mozilla-src-1.7.3

EXTRACTING MOZILLA SOURCE FILES

In the cygwin shell type:
cd /cygdrive/c/mozilla-src-1.7.3
tar -xvjf mozilla-source-1.7.3.tar.bz2
You can optionally remove the option 'v' which means verbose

IMPORTANT: do not extract the code under /home/... The build fails!! (Although it is clearly stated in http://www.mozilla.org/build/win32.html I had stupidly ignored this reccomendation and I had troubles)

At this point you should have the complete tree.

INSTALLING DEVELOPMENT PACKAGES IN CYGWIN
The standard Cygwin setup is not sufficient to build Mozilla. As stated in http://www.mozilla.org/build/win32.html you must install also
INSTALLING NETSCAPE WINTOOLS
Get them from http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip . I unzipped this archive and run the install.bat setting the MOZ_TOOLS variable to c:\moztools. Then I run from the cygwin shell the commands:

cd /cygdrive/c/moztools/include
dos2unix *
cd libIDL
dos2unix *
This is needed to convert DOS line ending to Unix line ending

SETUP SOME ENVIRONMENTAL VARIABLES

To set variables I modified the file
C:\cygwin1.5.11\cygwin.bat
as follows:
@echo off
C:
chdir C:\cygwin1.5.11\bin
set MOZ_TOOLS=C:\moztools
set PATH=%PATH%;%MOZ_TOOLS%\bin;C:\cygwin1.5.11\bin
bash --login -i

CONFIGURING MOZCONFIG
The file .mozconfig is used during the build and it must be stored in your home directory (actually you can also put it in your mozilla/ directory). In my case I created the file:
/home/davide/.mozconfig
The contents of my .mozconfig file are:

# basic mozconfig file with minimum requirements for MinGW gcc build
CC=gcc
CXX=g++
CPP=cpp
AS=as
LD=ld

# the following options don't yet work under gcc-on-win32
ac_add_options --disable-accessibility
ac_add_options --disable-activex

LAUNCH THE BUILD
cd /cygdrive/c/mozilla-src-1.7.3/mozilla
make -f client.mk build_all_depend
At this point you should succeed and after a good amount of CPU cycles you have your build done.

PROBLEMS WITH THE NSINSTALL TOOL
My first attempt to build failed with a message like:

sh /home/default/mozilla/nsprpub/build/cygwin-wrapper nsinstall -m 444
/home/davide/mozilla/nsprpub/pr/include/md/_win95.cfg
C:/WINDOWS/Desktop/Cygwin_Setup/home/default/mozilla/dist/include/nspr
nsinstall: \home\davide\mozilla\nsprpub\pr\include\md\_win95.cfg: No such
file or directory make[6]: *** [export] Error 3
The problem here seems to be in the position of the tree. I moved the tree from /home/davide/... to /cygdrive/c/... and it worked.

PROBLEMS WITH BINUTILS PACKAGE

The build seems to fail if you are using the last version of binutils (2.15.91). You have two options:
 
Although I applied the patch the build continued to fail. So I decided to downgrade binutils from 2.15.91
to version 2.15.90
with the cygwin setup and then the build succeeded.

To verify which version of binutils you have installed run the command:

ld --version


The patch
also reported in https://bugzilla.mozilla.org/attachment.cgi?id=160885&action=diff

The patch is (lines which starts with '-' are removed, lines with '+' are added)
Index: xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp
===================================================================
RCS file: /cvsroot/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp,v
retrieving revision 1.9
diff -u -r1.9 xptcinvoke_gcc_x86_unix.cpp
--- xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp 18 Apr 2004 14:18:18 -0000 1.9
+++ xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp 3 Oct 2004 02:08:49 -0000
@@ -134,7 +134,6 @@
".align 2\n\t"
#ifdef XP_WIN32
".globl " SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex\n\t"
- ".type " SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex,@function\n"
SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex:\n\t"
#else
".globl " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t"
@@ -193,9 +192,7 @@
"movl %ebp, %esp\n\t"
"popl %ebp\n\t"
"ret\n"
-#ifdef XP_WIN32
- ".size " SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex, . -" SYMBOL_UNDERSCORE "_XPTC_InvokeByIndex\n\t"
-#else
+#ifndef XP_WIN32
".size " SYMBOL_UNDERSCORE "XPTC_InvokeByIndex, . -" SYMBOL_UNDERSCORE "XPTC_InvokeByIndex\n\t"
#endif
);


ACKNOWLEDGMENTS

Thanks to Neil for his comments.

Created by Davide Carboni (dcarboni AT (REMOVE) crs4 DOT it) on 21/10/2004
Free Hit Counters
Sierra Trading Post

The citations project can be contacted through the mailing list or the member list.
Copyright © 2000-2017. All rights reserved. Terms of Use & Privacy Policy.