Assignment 1(lkates)

From CDOT Wiki
Jump to: navigation, search

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)


  • Firefox
  • Pulled from CVS
  • version 3.0a1


  • Cygwin (latest version???)
  • Microsoft Visual Studios .Net 2003 (VC7.1)
  • make 3.80 (NOT 3.81!)
  • moztools

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:

  1. I installed WinCVS to get the source code. Got it working based on the instructions from website. I managed to get the source code downloaded. Now what do I do with it?
  2. Downloaded cygwin in order to compile the source. Got it installed without a problem... or so I thought.
  3. Ran cygwin. Now I need to configure and so forth. But I can't find Configure anywhere. Time to read TFM again.
  4. 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 [1] and downloaded the tarball for Firefox Untarred them.
  5. 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.
  6. Cleared room on my HDD to accommodate the files and the build. I now have 1.5GB free.
  7. Re-read the requirements from on how to build with cygwin. First I had to rename link.exe to glink.exe. Not sure why, but did it anyways.
  8. Checked and edited cygwin.bat. There's an option there for moztools. What's that?
  9. 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.
  10. 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)
  11. 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.
  12. Found a couple of answers. First:
    1. 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.
    2. Read some more about the error, and came across 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.
    3. Compiled, and I'm not getting the cl error. But I am getting configure: error: --enable-application=APP is required. Back to the web. 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.
    4. 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
    5. 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.
    6. 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.
      1. 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.
      2. The next day: Insert lots of swearing here. Time to look at things right from the beginning.
    7. Okay, here's some facts:
      1. I'm using the source. That puts me in the 1.8.0 trunk, not the 1.8, which is Firefox 2. Check.
      2. I need to follow the instructions on
      3. 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
      4. There are special Wintools installation instructions. I've followed them (set MOZ_TOOLS to c:\moztools, and ran the install.bat file)
      5. 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
      6. I've installed cygwin including all the packages needed (including making sure make is 3.80 not 3.81)
      7. I'm using cl 13.10.3077, which is 7.1
      8. I'm using make 3.80, NOT 3.81
    8. Still crashing. What's going on? Time to hop on IRC.
    9. Went to, and chatted on #seneca. Vented my frustrations, and got some very useful information from Mike Shaver:
      1. Don't use Use the latest source instead.
      2. 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 file.
      3. Don't use configure/make/make build. Instead, use the file.
    10. 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.

  1. Delete all traces of source code from my hard drive.
  2. Delete all of the various versions of moztools and wintools I had around
  3. 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!

  1. Downloaded and installed wintools (which involved putting MOZTOOLS into my path and installing using the utility's install.bat)
  2. Downloaded latests source with cygwin's cvs (involved cvs'ing the file, and going from there)
  3. Ran into an error, which I forgot to write down. It was after I did my first cvs for the 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.
  4. Pulled the source, and used the Firefox Optimized Static configuration.
  5. 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.
  6. Ran make again. Left the computer overnight.
  7. 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: 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.