Assignment 1: Building the Fox
Well, what a eventful run this has been. Errors, errors, errors and some more errors-- then success!
- IBM Thinkpad 600x
- PIII 550
- 192MB RAM
- 1.5GB free on disk
- Windows 2000 (5.00.2195, SP4)
- Pulled from CVS
- version 3.0a1
- Cygwin (latest version???)
- Microsoft Visual Studios .Net 2003 (VC7.1)
- make 3.80 (NOT 3.81!)
Attempt 1: The Wrong Path
My first attempt to build Firefox failed. It wouldn't work, not matter how many documents, FAQs and guides I followed. Here's what I did wrong:
- I installed WinCVS to get the source code. Got it working based on the instructions from mozilla.org website. I managed to get the source code downloaded. Now what do I do with it?
- Downloaded cygwin in order to compile the source. Got it installed without a problem... or so I thought.
- Ran cygwin. Now I need to configure and so forth. But I can't find Configure anywhere. Time to read TFM again.
- It looks like my CVS might have mucked up. I'm abandoning CVS for now in favor of just getting the tarballs from the FTP. I went to  and downloaded the tarball for Firefox 22.214.171.124. Untarred them.
- As the docs point out, the source files should be kept under the cygdrive folder, and not the home folder. Made sure of that, at least.
- Cleared room on my HDD to accommodate the files and the build. I now have 1.5GB free.
- Re-read the requirements from mozilla.org on how to build with cygwin. First I had to rename link.exe to glink.exe. Not sure why, but did it anyways.
- Checked and edited cygwin.bat. There's an option there for moztools. What's that?
- Did some more RTFMing. moztools is a set of pre-build static libararies, and is needed to compile mozilla. Downloaded and installed them into c:\moztools. Made sure cygwin.bat reflected that.
- Cygwin says the source for mozilla needs to be in the cygdrive folder. Moved the mozilla folder to c:\cygwin\cygdrive\mozilla (\browser, since I'm working with Firefox)
- Okay, configure is there now. Excellent. Tried running it, but it failed on checking cl. Error message was checking whether the C compiler (cl ) works… no configure: error: installation or configuration problem: C compiler cannot create executables. Went to the web to read about this.
- Found a couple of answers. First:
- http://forums.mozillazine.org/viewtopic.php?t=363760& says that you need to install MinGW with cgywin's setup procedure. While going to fix that, I realized that I had forgotten to install some other non-default options, including perl, patchutils, make 3.80(not 3.81!), zip and unzip. Got all those installed, but still had the error.
- Read some more about the error, and came across http://www.squarefree.com/2003/08/19/a-minor-accomplishment/ He has several common errors there, including the one I had. His comment was to un-rem (comment) the line that calls vcvars32.bat, the variable file for cl. However, it wasn't remmed. (This is all in the cygwin.bat file). However, while looking at the file, I noticed that the path was wrong. It was trying to look up an old version of Visual Studios. I used FIND to find where my vcvars32.bat file was located, and pasted the path into the bat file.
- Compiled, and I'm not getting the cl error. But I am getting configure: error: --enable-application=APP is required. Back to the web. http://developer.mozilla.org/en/docs/Configuring_Build_Options says that I need to put an extra line into the .mozconfig file, which should be kept in the mozilla folder. I created the file, and put . $topsrcdir/browser/config/mozconfig into the .mozconfig file, so that it will source the pre-defined Firefox configuration file. Running .configure again now... Seems to be okay.
- Running make... Have an error. LINK : fatal error LNK1181: cannot open input file 'c:/moztools/lib/libidl-0.6.lib. Investigating. I opened up the moztools/lib folder, and looked at the contents. There's my problem! The file is called libidl-0.6_s.lib. I've made a copy of it called libidl-0.6.lib Let's see if that works. Ran make, another error. I have to do the same thing to glib-1.2_s.lib
- Uh-oh, somethings' crashed. About a minute into the build, I got a popup box informing me of an access violation. xpidl.exe - application error. The instruction at 0x77f87f6e referenced memeory at 0x0042109c The memory could not be written. It happened when make was processing the command
/cygdrive/c/cygwin/cygdrive/mozilla/./build/cygwin-wrapper ../../dist/bin/xpidl. exe -m header -w -I. -I../../dist/idl -o _xpidlgen/nsIAtom /cygdrive/c/cygwin/cygdrive/mozilla/xpcom/ds/nsIAtom.idl.Maybe I have too many programs open? Will try closing some stuff down and trying again.
- Happened again. The problem, according to the FAQ, seems to be that I have the VC7 glib and I need VC7.1 (since I'm using Microsoft Visual Studio .Net 2003). I've got the updated VC7.1 from Mozilla's FTP. It says that I should install them in a separate directory (ie: don't overwrite current Moztools). I've installed them to c:\moztools\vc71. Now I need to modify my .mozconfig so that the config knows where those two new files are.
- Unfortunately, this doesn't seem to work. Maybe I'm not doing it right, because it still crashes. I've spent hours working on this, and I can't see what's going on. I'm going to guess that it's something small and insignificant I'm overlooking. I'm putting it away for now, and I'll check again tomorrow and ask on IRC.
- The next day: Insert lots of swearing here. Time to look at things right from the beginning.
- Okay, here's some facts:
- I'm using the 126.96.36.199 source. That puts me in the 1.8.0 trunk, not the 1.8, which is Firefox 2. Check.
- I need to follow the instructions on http://developer.mozilla.org/en/docs/Windows_Build_Prerequisites_on_the_1.7_and_1.8_Branches
- To compile on Windows, I need to use Wintools, not Moztools Static. So I've wiped all the Moztools from my hard drive, and re-downloaded WIntools. They are in c:\moztools
- There are special Wintools installation instructions. I've followed them (set MOZ_TOOLS to c:\moztools, and ran the install.bat file)
- Since I'm using .net 2003, that means I am using VC7.1 As listed in the instructions, I did not install them in c:\moztools. I installed them in c:\moztools_vc71
- I've installed cygwin including all the packages needed (including making sure make is 3.80 not 3.81)
- I'm using cl 13.10.3077, which is 7.1
- I'm using make 3.80, NOT 3.81
- Still crashing. What's going on? Time to hop on IRC.
- Went to irc.mozilla.org, and chatted on #seneca. Vented my frustrations, and got some very useful information from Mike Shaver:
- Don't use 188.8.131.52. Use the latest source instead.
- To get the latest source, use CVS. But don't use WinCVS. Use the cvs command in cygwin. And be sure to checkout with the client.mk file.
- Don't use configure/make/make build. Instead, use the client.mk file.
- From there, I figured it was time to start from scratch, and try again.
Attempt 2: The Right Stuff
Armed with the knowledge that I was doing things wrong, I decided to start from the beginning.
- Delete all traces of source code from my hard drive.
- Delete all of the various versions of moztools and wintools I had around
- Reset the cygwin.bat to default (keeping a backup of it, of course)
Now I had to re-obtain the source. I went back to my initial Google search of "firefox build source". Except this time I read a bit further, and ended up at a very useful pard of the MDC. Documentation!
- Downloaded and installed wintools (which involved putting MOZTOOLS into my path and installing using the utility's install.bat)
- Downloaded latests source with cygwin's cvs (involved cvs'ing the clinet.mk file, and going from there)
- Ran into an error, which I forgot to write down. It was after I did my first cvs for the client.mk file, and was trying to pull the source. I got a 'cvs bad password, use cvs login' type error. The solution, simply enough, was to type cvs login and provide the anonymous password.
- Pulled the source, and used the Firefox Optimized Static configuration.
- Ran into another error: I didn't have NSIS installed. It is needed to build an installer for your final build. However, since I wasn't going to be installing, but instead running the final product, I added ac_add_options --disable-installer to my .mozconfig file.
- Ran make again. Left the computer overnight.
- Build succeeded!
I now have a working copy of "Minefield v3.0a1"
What I Learned
- Don't be afraid to ask for help on IRC. And don't be afraid to ask the same question twice. Sometimes the second answer is the right one.
- Read the manuals. Seriously. And if you are still having problems, look for a different manual. Maybe you're reading the wrong one.
- At some point, if you've gone down the completely wrong path, be prepared to start from scratch. Sometimes it is easier to rm -rf it all, and start from the beginning.
- Document what you do!
Came across this: http://lxr.mozilla.org/seamonkey/ The developers were talking about this on IRC. It's a web interface that allows you to keyword/string search the source code. Kinda like "find" but better.