citations
| resources: | Home Mailing List Installation Source Code Members Mini Forum Mozilla with cygwin HOWTO Screenshots |
|---|
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.3GETTING 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\foois viewed in the shell as (notice the slashes)
/home/davide/fooAny path outside the cygwin root can be referenced too because the Windows directory
C:\is mapped in cygwin as
/cygdrive/cThus the installation directory of my codebase
C:\mozilla-src-1.7.3is visible in the cygwin shell under
/cygdrive/c/mozilla-src-1.7.3EXTRACTING MOZILLA SOURCE FILES
In the cygwin shell type:
cd /cygdrive/c/mozilla-src-1.7.3You can optionally remove the option 'v' which means verbose
tar -xvjf mozilla-source-1.7.3.tar.bz2
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
- ash -- UNIX-like command line interpreter shell
- autoconf-2.13
- diffutils -- file comparison utility
- dos2unix (contained in
cygutils package)
- fileutils
- findutils
- gawk -- pattern matching language (Devel category)
- grep -- text search tool
- make -- dependency analyzer for software builds (Devel category)
- perl -- a scripting language used to control parts of the build (Interpreters category)
- sed -- a search and replace language
- sh-utils
- textutils
- unzip -- zip file extraction (Archive category)
- zip -- zip file creation (Archive category)
- gcc >= 3.2.2 (20030208)
- binutils >= 2.14.90 (20030807)
- w32api >= 2.4
- mingw-runtime >= 2.4
- gcc-mingw
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/includeThis is needed to convert DOS line ending to Unix line ending
dos2unix *
cd libIDL
dos2unix *
SETUP SOME ENVIRONMENTAL VARIABLES
To set variables I modified the file
C:\cygwin1.5.11\cygwin.batas 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/.mozconfigThe 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/mozillaAt this point you should succeed and after a good amount of CPU cycles you have your build done.
make -f client.mk build_all_depend
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 444The problem here seems to be in the position of the tree. I moved the tree from /home/davide/... to /cygdrive/c/... and it worked.
/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
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:
- applying a patch to the code:
- downgrading to 2.15.90
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
Sierra Trading Post