Wednesday, February 3, 2010

Firefox Build

I began by typing into Google 'download firefox source code' and stumbled across this page. It was nice enough to give me a link to the source code and some guidance that winzip and winrar don't (at least at the time the article was written) have the ability to extract .*bz2 and .tar files properly, and to do it with 7-zip. I extracted it into a directory on my computer and proceeded to look for instructions on how to build Firefox on the web.

I opened up a few websites, but only really looked at one page in particular. The author seemed to explain things very well, and it was clear and easy to follow. He said he was new at building Firefox, as was I so that was a promising commonality, but the main difference is he did it on visual studio 2005 and I was running it on visual studio 2008, so I had to change a few things in the batch setup file, being the directory.

It was all good and well until we came to the .mozconfig file that we had to create. The first error was that it was saying I didn't have it set to create .mozconfig.mk automatically. After I fixed that, it was saying I didn't have MOZ_PROJECT_CO or something along those lines set to a variable, yet scanning through the files I found a MOZ_PROJECT_CO=browser line, so I do not know what it was talking about there. I went searching on the web and stumbled across this page from mozilla that had this set up for the .mozconfig file

echo '. $topsrcdir/browser/config/mozconfig' > mozconfig # let's build Firefox...
echo 'mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-ff-release' >> mozconfig # ...in this directory...
echo 'mk_add_options MOZ_MAKE_FLAGS="-j4"' >> mozconfig # ...quickly.


however that didn't work either, and had the same moz_project_co issue. I was two seconds away from asking in the firefox channel of irc and had typed out half of the message, but then on my way to pastebin to paste what was happening, I decided to try something. I made a combination of the two and ended up with this...

# Building Firefox Trunk with Debugging
. $topsrcdir/browser/config/mozconfig > mozconfig

# Put all obj files in one place, not in src tree
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/firefox-objdir >> mozconfig
ac_add_options --disable-static
ac_add_options --enable-shared

# Debug Build Setup Options
ac_add_options --disable-optimize
ac_add_options --enable-debug

# I'm using Canvas for my work
ac_add_options --enable-canvas


and voila! after a quick

make -f client.mk checkout


it began!! Success!! At least for the checkout... There were a few 'command not found's at the beginning of the build but that was something in the .mozconfig file and it seemed to have been minuscule. The line numbers of the issues were, 3, 8, and 12, and those are the lines that are blank, so of course no command is found on a blank line...

I then ran

make -f client.mk build


hoping that it would all work out, but unfortunately it did not. It said to build the installer, I would need makensis, and to build without the installer, to reconfigure using --disable-installer. It is late now, and I am tired, so I thought I would speed up the process and disable the installer. Lo and behold, it ran for a little bit longer but ... not long enough ... as a new error has been brought to the surface...an error unlike any other...and error, full of unorganized and very confusing lines.

/cygdrive/c/proj/mozilla/build/cygwin-wrapper /cygdrive/c/proj/moztools/bin/nsinstall -m 644 ../mozilla-config.h /cygdrive/c/proj/mozilla/config/nsStaticComponents.h ../dist/include
/cygdrive/c/proj/mozilla/build/cygwin-wrapper: line 75: /cygdrive/c/proj/moztools/bin/nsinstall: Permission denied
/cygdrive/c/proj/mozilla/build/cygwin-wrapper: line 75: /cygdrive/c/proj/moztools/bin/nsinstall: No error
make[4]: *** [export] Error 1
make[4]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir/config'
make[3]: *** [export_tier_base] Error 2
make[3]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
make[2]: *** [tier_base] Error 2
make[2]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/cygdrive/c/proj/mozilla/firefox-objdir'
make: *** [build] Error 2


...Yea. Sooo...I guess something is wrong with cygwin-wrapper. That, or permission is denied to nsinstall. or both...line 75 in cygwin-wrapper is simply

exec $prog $args

Prog being the first argument after exec is run, and args being what follows after that...
I guess the issue is that nsinstall's permission is denied. I looked at it in windows explorer, and it does have a little administrators icon on the icon. Time to look to irc and see what they say...
I asked irc and there is no response. It is troublesome because recently my internet is not really working at home and I am stuck at the library most of the time. The only time my internet works reliably is after midnight...other than that downloads will stop not far in and productivity is hindered. I asked some irc folks but I guess it's too late for a response? Either way, I will continue to pick away at it, at 2 in the morning, after 5 unsuccessful hours in the library...maybe if I download these mozilla build tools, things will get better.

I downloaded the build tools that are defined as a prerequisite on Mozilla's development wiki, but unfortunately, it encountered a new error...

make[1]: Leaving directory `/c/proj/mozilla'
make -C /c/proj/mozilla/firefox-objdir
make[1]: Entering directory `/c/proj/mozilla/firefox-objdir'
Makefile:45: /cygdrive/c/proj/mozilla/config/config.mk: No such file or directory
Makefile:69: /cygdrive/c/proj/mozilla/browser/build.mk: No such file or directory
Makefile:91: /cygdrive/c/proj/mozilla/config/rules.mk: No such file or directory
make[1]: *** No rule to make target `/cygdrive/c/proj/mozilla/config/rules.mk'. Stop.
make[1]: Leaving directory `/c/proj/mozilla/firefox-objdir'
make: *** [build] Error 2

No rule to make target mozilla/config/rules.mk ehh ... well, that's odd because there's a rules.mk in the mozilla/config directory, so why do you need a rule to make it?? Bah!
I tried to just build it with the command make -f client.mk as it says in mozilla's site... only adding -B at the end to make all targets...and I will hope for the best. Sleep would be nice, but I think it's a thing of the past since I have to work on some C++ which is due tomorrow and I have not been able to find the time to work on it. I haven't watched tv for so long :(. I have re-enabled the installer to be built by the way since I am taking another route and using the mozilla build tools. An installer is definitely an integral part of any application, and it should be there.
Whoa...it's been running for a good 10 minutes. I may have something here. Maybe all I ever needed was that -B...never mind. Same problem. I don't understand why it's saying it's not making rules.mk when, for one, it's already made, and two, I did set a rule to make all targets (also known as rules.mk)...

make -B -f client.mk build ???
please.
nope
make -B -k -f client.mk build?
nope


So I have decided to scrap everything and just go with what it says on the mozilla developers website. If this works, then ... good. It should, why wouldn't it...? I have just run the first step, being

hg clone http://hg.mozilla.org/mozilla-central/


but it is taking forever. It's been about a half an hour and I don't think it's even half through. I can thank my internet connection for that. I am going to bed. In the morning, I will continue with the

make -f client.mk


Anndddd I tried to run make -f client.mk but unfortunately, I do need the Windows 7 sdk. The biggest problem with that is finding a connection that'll be able to get it in less than 6 hours, since it's 2.5 gb. My connection won't do it, since the sun is up and it'll continuously drop, but I am at school now and have begun the download...only 10 hours left...then hopefully there will be some success.

4 comments:

  1. Try this:
    http://zenit.senecac.on.ca/wiki/index.php/User:Jamesboston#Building_Firefox

    You're going to need the Windows 7 SDK.

    ReplyDelete
  2. As an option you can add "ac_add_options –with-windows-version=600" to mozconfig, if you don't want to download w7 SDKs.

    ReplyDelete
  3. that would have been very useful. Thanks! I finally got them downloaded though lol.

    ReplyDelete
  4. any chance to solve "No rule to make target mozilla/config/rules.mk"

    I've encounter to the same problem!

    ReplyDelete