Monday, September 21, 2009

Building the Minefield or: How I Put Some Under My Own Feet

This week in DPS909 it was time to build the latest development version of Mozilla Firefox.

The first time I ever built something after checking out from a repository was a few years ago with the Icculus FreeSpace 2 Linux port. This was followed a bit later later with the FreeSpace 2 Source Code Project, and then somewhat more recently with the C-Dogs SDL port. For all of these configuring the system and building was a simple affair. Most of the configuration files, like ./configure and make and makefile, were already included with the checked out files and waiting to be run. The most trouble to be had was ensuring one had all the dependencies; this usually meant attempting to build multiple times, with each time following a fix to another missing dependency.

Building Mozilla Firefox was much the same, in which much of the trouble was fullfilling the dependencies. I started with the simple build instructions. Having casually browsed only that page the first attempt failed miserably because I had neglected to install autoconf. As we will soon see this would not be the only time my unfortunate habit of acting before browsing the literature with due diligence would haunt me.

Then the second attempt failed. The error message stated autoconf 2.13 was missing, but I assumed that any newer version would do, so I got autoconf 2.64 from the Debian GNU/Linux repository. This was a very poor assumption on my part. Finally getting to Linux build instructions it said that only 2.13 would work. Some Googling revealed the newer versions of autoconf were not backward compatible and Mozilla had stuck with 2.13 to avoid breaking and having to rewrite their scripts.

At that point I was getting that sinking feeling. I do not cherish the thought of cobbling together a package for Debian which may not coexist nicely with a newer version in the repository. After all, I might need the newer version sometime, and what if I had to get other older libraries to get the older autoconf to work? Fortunately, after some searching, I discovered Debian maintained autoconf 2.13 in the repository for the exact reason of backward compatibility.

So now I had autoconf 2.13 and (surprise, surprise!) the third build attempt also failed. The code in configure was malformed and gave this cryptic message like:

/home/mlam/src/mozilla-central/configure: line 4980: syntax error near unexpected token `}'
/home/mlam/src/mozilla-central/configure: line 4980: `$as_echo "yes" >&6; }'


I admit I barely know the first thing about scripting and was not pleased with this since, I was fairly sure, this was not something I could fix by messing around with the script. Googling didn't turn up anything on this. Looking into the script the top comment said autoconf 2.64 was the generator. This got me worried: if the Mozilla script was using the wrong one something might be wrong with Debian's inner workings and this, again, was not something I relished poking and prodding. I read the Debian documentation for autoconf 2.13 on how which version to use was determined and as far as I could tell the Mozilla code was correctly setup to use 2.13.

So, going out on a limb and simply deleted the old configure and entered make -f client.mk yet again to regenerate. Fortunately that worked and got me past the problem.

Now, if I was in the habit of paying attention and reading the instructions, I could have avoided the previous problem. The error messages explicitly state to use

make -f client.mk build

when attempting to rebuild. It was only after solving the previous problem in that particularly ignorant fashion that I picked up on this.

The final problem was a run-of-the-mill missing dependency, in this case libidl.

Final time spend: over an hour puzzling through the build errors, and 20 minutes for the final successful build (naturally in my obstinance I insisted on using the system for other tasks at the same time.) So now Minefield is back on my system after a multi-year hiatus, although this time round I have no idea what I'm going to do with it.

However, all being said and done, building Firefox is ridiculously easy compared to the complexity of the program itself. No doubt a good number of people tore out hair getting the build infrastructure in place but the results are undoubtedly effective.

Now, if only Iceweasel 3.5.3 would enter the Debian Unstable repository...

2 comments:

Anonymous said...

"Now, if only Iceweasel 3.5.3 would enter the Debian Unstable repository..."

You said it brother!

F1LT3R said...

Dude your blog is so funny!

Post a Comment