Building FireFox

Found a good HOWTO on building FF on Windows [update: don't use this page. Use this one instead], but that document is a bit out of date and needs some updating. In particular:
  1. Better to download a tarball of the source rather than do a CVS checkout. Note that the tarball includes CVS meta data so if you want to get updates later, you can. This reduces load on the mozilla servers (good for them), and is a fast way to bootstrap good for you).
  2. .mozconfig is optional - and the parameters have changed significantly since that document was written, and they no longer work.
  3. You need Cygwin, but you need to make sure Perl, Python, and Make are present. And possibly more stuff.
Notes:

http://developer.mozilla.org/en/docs/Configuring_Build_Options
http://mxr.mozilla.org/mozilla/source/browser/config/mozconfig?raw=1
be careful noto to save in PC format as make doesn't like CRLFs.

One bummer about this build is that it spends about 10 minutes doing environment checks. I bet there's a way to skip it, but I don't know what it is yet (probably setting correct build options). This wouldn't be so bad, except that the loop is {run build, get error, fix dependancy, repeat}. Every iteration gets you a bit farther, but it takes a lot of time. (Personally, I find solace in blogging about the experience while I wait.) A nice touch would be if make could remember all the checks it did last time it ran.

The HOWTO above very wisely warns the user that it probably won't work right the first time. But it should add that it probably won't work right the 2nd, 3rd, or 4th time either. :)

Things I had to install (or fix):
  1. make (cyg)
  2. bad options (edit .mozconfig)
  3. python (cyg)
  4. makensis (skip: --disable-installer)
  5. iconv (a character conversion library. at first I added C:\bin\xampp-1.6.4\apache\bin to build path but that didn't work; I read the gnu page and noticed it's probably called libiconv in cygwin. added the "dev" version, and that worked)
And at this point it's actually generating more makefiles, which is a start, I guess. I'll be really happy once it starts actually compiling stuff. :)

Getting this build to work reminds of me of a nice little puzzle game I ran into yesterday called "Thief" that basically dumps you into a puzzle with neither explanation or context. You just have to figure it out. I kind of like that genre of game.

While the build runs, I ran a search to see if anyone has built FF with the Eclipse CDT. The best link I found was from over 2 years ago, and the short answer is "not really". For a FF build I might try something like Pulse with only the single project in the workspace. (Holy crap I'm the 5th result for "genuitec pulse".)

(Ooh and now gcc is getting called, and it's not puking! Cool!)

Anyway, so yeah a stripped down, shiny new Eclipse 3.0 with just the CDT installed, a workspace with just one monster project.... Sounds to me like the experiment should be tried again.

(OMG it looks like the build is doing a depth-first traversal of a tree of about 6000 files, building a command line and then calling gcc on each file. I mean, whoah.)

Sigh. I should have known. 5 hours later, the build failed. Here's the output:

Creating .deps
/cygdrive/c/home/josh/moztools/mozilla/build/cygwin-wrapper /cygdrive/c/home/josh/moztools/bin/nsinstall -m 644 /
e/c/home/josh/moztools/mozilla/xpinstall/cleanup/InstallCleanupDefines.h ../../dist/include/xpinstall
make[5]: Leaving directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir/xpinstall/cleanup'
make[5]: Entering directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir/xpinstall/stub'
Creating .deps
make[5]: Leaving directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir/xpinstall/stub'
make[4]: Leaving directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir/xpinstall'
make[4]: Entering directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir/security/manager'
/usr/bin/make -C /cygdrive/c/home/josh/moztools/mozilla/security/coreconf MAKE="/usr/bin/make -j1" -j1 CC="/cygdr
ome/josh/moztools/mozilla/build/cygwin-wrapper cl" SOURCE_MD_DIR=c:/home/josh/moztools/mozilla/firefox-objdir/dis
c:/home/josh/moztools/mozilla/firefox-objdir/dist NSPR_INCLUDE_DIR=c:/home/josh/moztools/mozilla/firefox-objdir/d
lude/nspr NSPR_LIB_DIR=c:/home/josh/moztools/mozilla/firefox-objdir/dist/lib MOZILLA_CLIENT=1 NO_MDUPDATE=1 NSS_E
CC=1 BUILD_TREE=c:/home/josh/moztools/mozilla/firefox-objdir NS_USE_GCC= NS_USE_NATIVE=1 OS_TARGET=WIN95 USE_DEBU
clean
make[5]: Entering directory `/cygdrive/c/home/josh/moztools/mozilla/security/coreconf'
../coreconf/rules.mk:368: target `c' doesn't match the target pattern
../coreconf/rules.mk:415: target `c' doesn't match the target pattern
../coreconf/rules.mk:416: warning: overriding commands for target `c'
../coreconf/rules.mk:369: warning: ignoring old commands for target `c'
../coreconf/rules.mk:444: target `c' doesn't match the target pattern
../coreconf/rules.mk:445: warning: overriding commands for target `c'
../coreconf/rules.mk:416: warning: ignoring old commands for target `c'
../coreconf/rules.mk:448: target `c' doesn't match the target pattern
../coreconf/rules.mk:449: warning: overriding commands for target `c'
../coreconf/rules.mk:445: warning: ignoring old commands for target `c'
../coreconf/rules.mk:452: target `c' doesn't match the target pattern
../coreconf/rules.mk:453: warning: overriding commands for target `c'
../coreconf/rules.mk:449: warning: ignoring old commands for target `c'
../coreconf/rules.mk:467: target `c' doesn't match the target pattern
../coreconf/rules.mk:468: warning: overriding commands for target `c'
../coreconf/rules.mk:453: warning: ignoring old commands for target `c'
../coreconf/rules.mk:471: target `c' doesn't match the target pattern
../coreconf/rules.mk:472: warning: overriding commands for target `c'
../coreconf/rules.mk:468: warning: ignoring old commands for target `c'
../coreconf/rules.mk:969: *** multiple target patterns. Stop.
make[5]: Leaving directory `/cygdrive/c/home/josh/moztools/mozilla/security/coreconf'
make[4]: *** [.nss.cleaned] Error 2
make[4]: Leaving directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir/security/manager'
make[3]: *** [export_tier_toolkit] Error 2
make[3]: Leaving directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir'
make[2]: *** [tier_toolkit] Error 2
make[2]: Leaving directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/cygdrive/c/home/josh/moztools/mozilla/firefox-objdir'
make: *** [build] Error 2


I may need to contact the developer list or google groups for this one. I feel strangely unmotivated.

9pm After dinner and a little nap, I feel better about the whole
situation. I did a little searching, and I'm not the only one with this
problem. Apparently the culprit is make, and I need to go back to v
3.80. Having this problem actually pointed out a very nice HOWTO from Mozilla itself which is much better than the HOWTO I started off with. Not quite sure how I missed it....

No comments: