A minor accomplishment

I built Mozilla Firebird for the first time yesterday! It took me 3 days to convert my Mozilla build setup to build Mozilla Firebird. I started with a working MSVC.Net Mozilla build and used Gemal's guide to building Mozilla Firebird [with gcc], thinking I would be able to skip the gcc-related steps since I already had a working build environment for Mozilla.

I switched from msvc.net to gcc twice (once accidentally, once intentionally), but ended up using msvc.net. Read more for a boring list of the problems I ran into, and a much shorter list of suggestions for changes to Gemal's page.

Can't create .mozconfig

Explorer says "You must type a filename" when I try to rename "New text document.txt" to ".mozconfig", despite the fact that ".mozconfig" is a legal filename in the Windows file system.

What I did: create the file using "echo foo > .mozconfig".

No rule to make mozilla/toolkit/content/buildconfig.html

/cygdrive/c/buildmoz/mozilla/build/cygwin-wrapper -up /usr/bin/perl -I/cygdrive/
c/buildmoz/mozilla/config /cygdrive/c/buildmoz/mozilla/config/aboutime.pl locale
/build.dtd ../config/build_number /cygdrive/c/buildmoz/mozilla/toolkit/locale/bu
ild.dtd.in
make[3]: *** No rule to make target `content/buildconfig.html', needed by `libs'
.  Stop.
make[3]: Leaving directory `/cygdrive/c/buildmoz/mozilla/toolkit'
make[2]: *** [tier_50] Error 2
make[2]: Leaving directory `/cygdrive/c/buildmoz/mozilla'
make[1]: *** [default] Error 2
make[1]: Leaving directory `/cygdrive/c/buildmoz/mozilla'
make: *** [build] Error 2

What I did: start over with a new tree.

Your compiler appears to have a known bug

"configure: error: Your compiler appears to have a known bug where long long 
is miscompiled when using -pedantic.  Reconfigure using --disable-pedantic."

This error message is telling me to: "./configure --disable-pedantic" in bash, or add "ac_add_options --disable-pedantic" to .mozconfig.

Better solution: upgrade gcc.

Even better solution: realize I was inadvertantly using gcc and should be using msvc. (See next item)

What i did: Added "ac_add_options --disable-pedantic" to .mozconfig.

mbstring.h: No such file

w95io.c:43: mbstring.h: No such file or directory
...
make[7]: *** [w95io.o] Error 1
make[7]: Leaving directory `/cygdrive/c/buildmoz/mozilla/nsprpub/pr/src/md/windows'

What I did: realized the .mozconfig I copied from gemal's site included some suspicious-looking lines that seem to tell the build process to use gcc rather than msvc, and removed them.

glib.h: No such file

In file included from c:/buildmoz/mozilla/xpcom/typelib/xpidl/xpidl.c:42:
c:/buildmoz/mozilla/xpcom/typelib/xpidl/xpidl.h:49:18: glib.h: No such file or directory

Went back to doing a gcc build.

Tried the dos2unix thing gemal talks about under "problems with glib.h"... that didn't fix it.

Tried getting mingw... and putting it in the path...

Parse errors in nsCharTraits.h

../../../dist/include/string/nsCharTraits.h:383: warning: ISO C++ forbids
   declaration of `difference_type' with no type
../../../dist/include/string/nsCharTraits.h:383: `::difference_type' is not a
   valid declarator
../../../dist/include/string/nsCharTraits.h:383: parse error before `;' token
make[5]: *** [nsASingleFragmentString.o] Error 1
make[5]: Leaving directory `/cygdrive/c/buildmoz/mozilla/xpcom/string/src'

Tried rebuilding the xpcom directory... same error.

Trying msvc again (remove gcc stuff from .mozconfig)... That didn't change anything, so trying clobbering... trying with a completely new tree, starting with building Seamonkey...

cl cannot create executables

checking whether cl can create executables... no

Un-REMmed the line "call vcvars32.bat" in the batch file I run before building. Had I REMmed that line when I tried to switch from msvc to gcc?

Yay! Building Seamonkey with MSVC worked! (But the Seamonkey icons were screwed up... more on that later.) Switching back to a firebird build config, but without the lines that make it use gcc.

defaultlib 'MSVCRT' conflicts with use of other libs

Creating library xpcom.lib and object xpcom.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; us
e /NODEFAULTLIB:library
xpcom.dll : fatal error LNK1169: one or more multiply defined symbols found
make[4]: *** [xpcom.dll] Error 145

What this error message is telling me to do: ???

What I did: figured switching from Seamonkey to Firebird should cause such a strange thing to happen in the xpcom directory, so I clobbered the xpcom directory (cd xpcom, make clean, make). That worked.

Because that fixed it, I clobbered everything (make -f client.mk clean, make -f client.mk) out of paranoia. That gave me a working Firebird build, but...

No icons

Gemal's page warned me about this, so I knew what to do: change cygwin to use unix line endings. This scared me, because I do other things with cygwin that involve text files. After checking that running dos2unix on one of my log-parser-genearated text files didn't break my text editor, I ran the cygwin installer and told it to use unix line endings. Since I had already upgraded all my cygwin programs (gcc, etc), the cygwin installer didn't have to download anything while making this change, so it was fast.

make -f client.mk clean...

Error while cleaning!?

Makefile:34: *** missing separator.  Stop.
make[2]: Leaving directory `/cygdrive/c/buildmoz/mozilla/toolkit/components/hist
ory/public'
make[1]: *** [clean] Error 2
make[1]: Leaving directory `/cygdrive/c/buildmoz/mozilla'
make: *** [clean] Error 2

What I did: make a new tree.

That gave me a working Firebird build with icons, but...

It was a non-debug build!

This was easy to fix: I just removed "ac_add_options --disable-debug" from .mozconfig.

Now I have a working Firebird debug build. That means there is a console where I can see debug output and assertions (but I use "set XPCOM_DEBUG_BREAK=warn" before running MozillaFirebird.exe so assertions don't bring up annoying dialogs). I think having a debug build is also necessary for using the MSVC visual debugger.

Moral of the story

Gemal should add comments to his .mozconfig, making it clear that the file has two sections: "# Tell the build process to build with gcc" and "# Build firebird instead of the seamonkey suite". Also, he should remove the line "ac_add_options --disable-debug" from his .mozconfig for a non-optimized build, or remove the text implying that it is a debug build. And I should be more careful when I copy configuration files from other people.

4 Responses to “A minor accomplishment”

  1. cls Says:

    > I built Mozilla Firebird for the first time yesterday! It took me 3 days to convert my Mozilla build setup to build Mozilla Firebird.

    Egads, man! Converting from SeaMonkey -> Firebird should be as simple as:

    1) Removing the old build from your tree: make -f client.mk distclean’
    2) Configuring your build for FireBird using the options recommended at http://lxr.mozilla.org/mozilla/source/browser/README.html
    3) Repulling with the updated mozconfig file so that you pull the firebird code.
    4) Rebuilding as normal.

  2. Jesse Ruderman Says:

    According to http://forums.mozillazine.org/viewtopic.php?t=32766 , this error can’t always be solved by calling vcvars32.bat:

    checking whether the C compiler (cl ) works… no
    configure: error: installation or configuration problem: C compiler cannot create executables.

  3. Jesse Ruderman Says:

    Btw, cls is right. It would have been that simple if I hadn’t copied too much of gemal’s .mozconfig.

  4. Jesse Ruderman Says:

    My .mozconfig:

    ac_add_options –disable-composer
    ac_add_options –disable-ldap
    ac_add_options –disable-mailnews
    ac_add_options –disable-tests
    ac_add_options –enable-crypto
    ac_add_options –enable-strip
    ac_add_options –enable-strip-libs
    export MOZ_PHOENIX=1
    mk_add_options MOZ_PHOENIX=1