multi-OS builds from one source tree

Someone asked me recently about the tabmail patch for Thunderbird, and, in some spare time between the super-intensive Hungarian language classes I was attending the last two weeks, I thought I'd see what it would take to get the patch working in Thunderbird 2.0.

I also figured I'd take the opportunity to switch my Windows build environment from the old Cygwin-based environment to the new MSYS-based MozillaBuild environment and--following roc's lead--try to set up a shared source directory on my Mac laptop that my Linux and Windows Parallels-based VMs could build from.

Setting up an SMB/CIFS share in Mac OS X via Apple > System Preferences > Sharing was trivial.

And mounting the share in Linux also proved fairly easy. I just had to install the smbfs package (available from Applications > Configuration > Synaptic Package Manager in Ubuntu 6.10) and then use Linux's standard mechanisms for mounting to an arbitrary filesystem location, f.e. via the smbmount command:

smbmount // ~/Machome -o username=myk

Note: you need to setuid on the smbmnt and smbumount binaries to be able to mount as a non-root user.

Getting things working on Windows proved harder, however. I tried to use mount to mount the share:

mount \\\myk /home/myk/Machome

But mount complained "function not implemented", and googling for a solution proved unfruitful.

Then I tried adding a mount point to /etc/fstab per the instructions in /etc/fstab.sample, which got MSYS to mount the share (after also restarting Windows, since MSYS only parses /etc/fstab on DLL initialization), but then cl mistranslated a filename on the share and died with this error:

cl -Fohost_cppsetup.obj -c -TC -nologo -Fdhost_cppsetup.pdb -DXP_WIN32 -DXP_WIN
-DWIN32 -D_WIN32 -DNO_X11 -Ox -MD -DINCLUDEDIR=\"/usr/include\"
-DOBJSUFFIX=\".obj\" -I../../dist/include/mkdepend -I../../dist/include
-I../../dist/include/nspr -I../../dist/sdk/include -I../../dist/include/nspr
cl : Command line warning D4002 : ignoring unknown option
cl : Command line error D2003 : missing source filename

I thought perhaps I could fool cl with a symbolic link:

ln -s /home/myk/Machome /home/myk/Machome2

But MSYS's version of ln apparently copies the directory (and all its contents) instead of linking to it (at least for network shares).

Finally I discovered that I could map a drive letter to the share in Windows Explorer > Tools > Map Network Drive, which MSYS (after restarting Windows again) maps to a path (/z in my case) that--although it's not where I want it--at least doesn't get screwed up by cl.

So now things are (almost) working. But not quite, as I'm seeing strange build errors like this one (when trying to build Firefox on the trunk):

/c/mozilla-build/moztools/bin/nsinstall -m 644 _xpidlgen/mozIPersonalDictionary.h _xpidlgen/mozISpellCheckingEngine.h _xpidlgen/mozISpellI18NUtil.h _xpidlgen/mozISpellI18NManager.h ../../../dist/include/spellchecker
make[5]: Leaving directory `/home/myk/Projects/minefield/build/firefox-opt/extensions/spellcheck/idl'
make[5]: Entering directory `/home/myk/Projects/minefield/build/firefox-opt/extensions/spellcheck/locales'
make[5]: Leaving directory `/home/myk/Projects/minefield/build/firefox-opt/extensions/spellcheck/locales'
make[5]: Entering directory `/home/myk/Projects/minefield/build/firefox-opt/extensions/spellcheck/myspell'
make: Entering an unknown directory
make: *** src: No such file or directory. Stop.
make: Leaving an unknown directory

And this one (when trying to build Thunderbird with the tabmail patch against the release tag):

/c/mozilla-build/moztools/bin/nsinstall /z/Projects/bonecho/mozilla/xpfe/bootstrap/showOSAlert.cpp /z/Projects/bonecho/mozilla/toolkit/xre
nsinstall: cannot copy z:\Projects\bonecho\mozilla\xpfe\bootstrap\showOSAlert.cpp to z:\Projects\bonecho\mozilla\toolkit\xre\showOSAlert.cpp: Access is denied.

So I'm still working on building on Windows.

FWIW, build times feel OK on Linux and bad (but tolerable, for occasional use) on Windows, where initial build configuration and CVS operations seem particularly slow.

Speaking of CVS operations, I edited MozillaBuild's start-msvc71.bat file to start ssh-agent so I wouldn't have to enter my SSH key for every CVS transaction:

start "MSYS Shell - MSVC7.1 Environment" "%MOZILLABUILD%\msys\bin\ssh-agent"
"%MOZILLABUILD%\msys\bin\rxvt" -backspacekey  -sl 2500 -fg %FGCOLOR% -bg %BGCOLOR%
-sr -fn "Lucida Console" -tn msys -geometry 80x25 -e /bin/bash --login -i

Note: unlike in Cygwin, ssh-add in MSYS only registers ~/.ssh/identity by default. To get it to register your SSH v2 DSA private key, you have to specify the path to that key on the command line, i.e.:

ssh-add ~/.ssh/id_dsa

FWIW, MozillaBuild is a dream to install compared to the old Cygwin-based environment, but I miss the more Unixy Cygwin, not to mention the much more functional Puttycyg terminal.

No comments: