Sunday, January 28, 2007

Compiling Firefox

After a week of struggle, I finally gave up on compiling the Firefox 2 source tree with Visual C++ 2005 Express Edition. I used to use VC6 to compile the source, but since I now have a Core 2 Duo machine on hand, I wanted to see the differences on using SSE2 etc optimization options. But unfortunately, 2005EE is not the official tools for Firefox 2 and I can't get it to compile.

So yesterday I turned to try the Firefox trunk source, which is the Firefox 3. There were some compiling issues to solve (e.g. can't use the official branding option as the resource manager can't compile the icon). Eventually, I got the source compiled! But then the big problem came: the browser would crash just after rendering a page.

At first I thought it has to do with the compiler options (need to admit that I was quite aggressive on using O2, arch:SSE2 etc options :P). But after 10+ hours of tweaking and re-compiling, the problem still won't go away.

This morning, I noticed that the browser crash has something to do with the gkgfxthebes.dll library. Since Thebes is the C++ wrapper for Cairo, I tried to tweak the options for the default toolkits. And suddenly the browser worked without problem. But then, when I tried to remove the tweaking and re-compile, the browser still works! So I guess the crash was caused by programming bugs and someone just fixed them last night... orz

Anyway, will now try various optimization parameters...

PS. Currently I am using this .mozconfig. Can really feel the rendering speed improved when using SSE2.

. $topsrcdir/browser/config/mozconfig

ac_add_options --enable-optimize="-O2 -arch:SSE2 -EHsc -GLT"

ac_add_options --disable-debug
ac_add_options --enable-static
ac_add_options --disable-shared
ac_add_options --disable-tests
mk_add_options MOZ_CO_PROJECT=browser

ac_add_options --disable-activex
ac_add_options --disable-activex-scripting
ac_add_options --disable-xpconnect-idispatch
ac_add_options --disable-accessibility

No comments: