Mobile/Build/Windows Mobile Build Instructions
Windows Mobile Build Instructions
work in progress - things are changing as we speak, er.. as you read this
Overview
This page describes the commands for building the latest version of the Windows Mobile XULRunner application using either Visual Studio 2005 or Visual Studio 2008 and the MozillaBuild environment.
These instructions are changing frequently. The Windows Mobile build of XULRunner and Mobile Fennec is undergoing major improvements and bug fixes. Do not be surprised if your attempt to build and/or run do not immediately work.
People focused on the Windows Mobile build are currently using the #wince channel to communicate about Windows Mobile build-specific issues.
Did we mention that things are changing frequently?
Setup
You will only have to do this setup once.
Only Visual Studio 2005 (also known as Visual Studio 8, or VS8) and Visual Studio 2008 (also known as Visual Studio 9, or VS9) are currently supported.
Visual Studio 2008 Express Edition does NOT work for building, because the Windows Mobile SDK Installer will not successfully complete with only Visual Studio 2008 Express installed.
You will need to install your Visual Studio version before continuing with these instructions.
Follow the instructions here to setup a windows development environment.
Because the Windows Mobile build uses a patch queue, you must turn on the mercurial queues extension.
Then you need to install the Windows Mobile 6 Professional SDK (WM6 Pro SDK). To resolve dependencies in the installation of the Windows Mobile 6 Professional SDK, you might need to install some extra software. In this case, the WM6 Pro SDK Installation program will tell you what software you need to install.
You will also need to download and install the Windows Mobile 6.1 Professional Localized Emulator Images.
IMPORTANT NOTE
(by wolfe in #wince) you NEED to install the WM6.1 Emulator Images, because Microsoft fixed something in between 6.0 and 6.1 - so now the specification of memory size via the Emulator Options dialog box works.
then you need to increase the amount of memory available in your chosen 6.1 Emulator (BEFORE you run the chosen 6.1 Emulator for the first time). Otherwise you'll receive "(e)", or "not enough storage is available to complete this operation".
You can increase the amount of memory in your emulator by using the VS8 tools menu, options dialog box
find the device tools | devices section, select your desired emulator, click on the properties... button, then press the Emulator Options... button
Once you are looking at the Emulator Options dialog box, check the Specify RAM Size check box - and enter in 256 (range from 1 to 256)
BUT - BUT - BUT - The Emulator built into Visual Studio 2005 / VS8 does not work for mapping a local directory on your PC into the Emulator's \Storage Card (or \Storage Card2)
SO - If you want to debug via Emulator, you need VS9 / Visual Studio 2008. And you probably need a minimum of the Visual Studio 2008 Professional version, because the Express version does not allow the WinMobile 6 SDKs to be installed
Bottom Line - you need to either test on-device, or use VS9 Pro (or better)
Downloading and Building
These directions assume you have a c:\mozilla-build directory, created by downloading the [Windows Mozilla Build Setup version 1.3].
Mercurial Version In Mozilla-Build version 1.3
NOTE: As of 20-Nov-2008, Mozilla Build Setup version 1.3 includes a slightly stale version of Mercurial (version 1.0.1+20080525). The latest Mercurial has a version number of 1.0.2+20080813. The latest Mercurial is downloadable directly from [Selenic's Web Site].
In order to use the latest Mercurial, you have two basic choices:
(1) Remove the c:/mozilla-build/hg directory, and replace it with the contents of C:/Program Files/Mercurial after you have installed the latest download from Selenic.
(2) Go into c:/mozilla-build/msys/etc/profiles.d/profile-extrapaths.sh and modify the /c/mozilla-build/hg directory to say /c/Program Files/Mercurial
You can try updating to the latest version of Mercurial if you have troubles with hg.exe
Downloading The Sources And Patch Queue
Run the batch file C:\mozilla-build\start-msvc8.bat (or C:\mozilla-build\start-msvc9.bat) NOTE: This will setup and open a MingW32 command prompt. All further commands are to be run inside MingW32. $ cd /c/hg # assuming you've created /c/hg/ for your mozilla source tree $ hg clone http://hg.mozilla.org/mozilla-central $ cd mozilla-central $ export topsrcdir=`pwd` # $topsrcdir becomes the path to mozilla-central/ $ hg clone http://hg.mozilla.org/mobile-browser mobile $ wget http://people.mozilla.org/~blassey/mozconfig_wm6_full $ mv mozconfig_wm6_full mozconfig $ cd .hg $ hg clone http://hg.mozilla.org/users/blassey_mozilla.com/wince-patches patches $ cd .. $ export PATH="$PATH:$topsrcdir/build/wince/tools/bin"
Setting Up Your MOZCONFIG File
Building options are controlled by mozconfig, a master file within your top source directory (in our case, /c/hg/mozilla-central/mozconfig). Here is our current mozconfig for building WinMobile:
# Options for client.mk. mk_add_options MOZ_BUILD_PROJECTS="xulrunner" mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/objdir-wm6 # Disabling tests due to bug 454881 ac_add_options --disable-tests #WINCE specific options ac_add_options --disable-javaxpcom ac_add_options --disable-plugins ac_add_options --disable-accessibility ac_add_options --disable-printing ac_add_options --disable-oji ac_add_options --disable-vista-sdk-requirements ac_add_options --disable-updater ac_add_options --disable-installer ac_add_options --disable-xpinstall ac_add_options --enable-image-decoders="png gif jpeg" CROSS_COMPILE=1 CC=$topsrcdir/build/wince/tools/bin/arm-wince-gcc CXX=$topsrcdir/build/wince/tools/bin/arm-wince-gcc CPP=$topsrcdir/build/wince/tools/bin/arm-wince-gcc LD=$topsrcdir/build/wince/tools/bin/arm-wince-link AR=$topsrcdir/build/wince/tools/bin/arm-wince-lib AS=$topsrcdir/build/wince/tools/bin/arm-wince-as MIDL=/c/Program\ Files/Microsoft\ Visual\ Studio\ 9/VC/ce/bin/x86_arm/midl.exe RC=$topsrcdir/build/wince/tools/bin/arm-wince-res mk_add_options AR=@TOPSRCDIR@/build/wince/tools/bin/arm-wince-lib ac_add_options --target=arm-wince ac_add_options --enable-win32-target=WINCE ac_add_options --enable-default-toolkit=cairo-windows ac_add_options --with-wince-sdk="c:/program files/windows mobile 6 sdk/pocketpc/include/armv4i"
Building XULRunner and Mobile Fennec Code
Now you can build xulrunner and the mobile fennec code using these commands:
$ hg qpush -a $ make -f client.mk build
Notes After Building
Copy MOZCE_SHUNT.DLL
To debug fennec in VS8/9, you will have to copy
$topsrcdir/build/wince/shunt/build/vs[89]/mozce_shunt.dll
into
$OBJDIR\mobile\dist\bin\xulrunner
so that the .dll file is in the same directory as where xulrunner.exe is in.
Otherwise, you will receive a Could not find 'XULRunner' (or one of its components). Make sure that the path and filename are correct and that all the required libraries are available. error dialog if you try to run XULRunner.exe from a File Explorer.
Or the VS8 IDE will say that it is Unable to start program '\Storage Card\bin\xulrunner.exe'. An error occurred that usually indicates a corrupt installation (code 0x8007007e). If the problem persists, repair your Visual Studio installation via 'Add or Remove Programs' in Control Panel.
Both of these rather cryptic messages try to tell you that an executable file (EXE or DLL) depends upon a DLL, and that DLL could not be found.
Debugging Fennec
There is a bug in the way that Windows CE searches for executable files that means WinMobile can not search correctly for DLLs desired by xulrunner when launched by fennec.
There are three work-arounds to this problem, and you can select which work-around appeals to you the most:
(1) Copy all xulrunner files to the same directory as the fennec executable
(2) Copy all xulrunner files to the \Windows directory on your device (NOTE: does not work unless your Windows Mobile device has a LOT of space - i.e. HTC Touch Diamond, GTC Touch Pro, others with > 192 MByte)
(3) Change your Registry's OEM Search Path string to add your xulrunner's bin directory. Further information for this option is available [via Microsoft DevNetwork]. Note that you will have to reboot your WinMobile device for a changed OEM Search Path to take effect.
Visual Studio 2005 / Visual Studio 8
Visual Studio 2005 (VS8) has the following issues when debugging:
- VS8 is available for free from Microsoft, with is a great thing for part-time hackers.
- You can compile xulrunner and fennec, then copy the executables to a device and try running the executables.
- The main people working on WinMobile are using VS9 for compiling and debugging.
- VS8 Emulator's shared-directory driver does not work properly. If you try to use the Emulator supplied with VS8, you will receive LOTS of random errors and faults. You might be able to eventually get a good run of the xulrunner application, but you will also get very frustrated at the same time.
Visual Studio 2008 / Visual Studio 9
Visual Studio 2008 (VS9) has the following issues when debugging:
- To run / debug within a VS9 Emulator, you NEED to download and install the [Microsoft Windows Mobile 6.1 Emulator Images]
- The WinMobile 6.1 Emulator Images installation updates the Emulator, fixing a bug with setting the amount of memory within an Emulator Image.
- To run / debug xulrunner and fennec, you will need to increase the amount of memory available to the WinMobile 6.1 Emulator Image in which you are running.
- To increase the amount of memory available to your Emulator Image, do the following within VS9:
- Pull down the Tools menu
- Select the Options... menu item
- Find the Device Tools section in the list on the left hand side
- Find and select the Devices sub-section
- Find and select the desired Emulator Image
- Press the Properties... button
- Press the Emulator Options... button
- Check the Specify RAM Size checkbox
- Enter a number greater than 192 (and less than or equal to 256) into the edit box.
- Press OK to close the Emulator Properties dialog box
- Press OK to close the Emulator Image dialog box
- Press OK to close the Options dialog box
- When you start up your Emulator Image, verify that you have the RAM you specified in the Emulator Properties dialog box.
- If your Emulator Image does not have the RAM you specified, you may need to make a new copy of the Emulator in order to correctly specify the RAM size available to your Emulator Image.
- The main people working on WinMobile also use VS9 to run / debug on-device.
Setting Up MyBrowser
A simple XULRunner application, MyBrowser, is used to test the XULRunner code.
Download the MyBrowser Application using this link.
The XULApp file is a ZIP file with a number of files and directories. Further explanation of XULRunner and the XULApp format can be found here.
rename mybrowser-0.2.2.xulapp mybrowser-0.2.2.xulapp.zip Unzip mybrowser-0.2.2.xulapp.zip into its own subdirectory, while preserving it's ZIP file directory structure. rename mybrowser-0.2.2.xulapp mybrowser Edit mybrowser\application.ini file, replacing: MaxVersion=1.8.0.* with: MaxVersion=1.9.*.* copy -r mybrowser c:\mozilla\unicode\objdir-wm6-debug\dist\bin
Setting Up For Debugging MyBrowser
You can debug the MyBrowser XULapp from within Visual Studio by using the WinCE shunt Visual Studio Project, and adjusting the deployment device and executable to be run.
1. Open Visual Studio 2005 (Visual Studio 8) Integrated Development Environment (IDE) 2. Open the solution c:\mozilla\unicode\build\wince\shunt\build\vs8\mozce_shunt_static.sln 3. In the Solution Explorer, right mouse click on the mozce_shunt_static project 4. Select the Properties pop-up menu item 5. Under the configuration properties, highlight the Deployment section 6. Make the selected Deployment Device be "Windows Mobile 6 Standard Emulator" 7. Press the Apply button if necessary to save your new selection 8. Under the configuration properties, highlight the Debugging section 9. For Remote Executable, enter \Storage Card\bin\xulrunner.exe 10. For Command Arguments, enter -app mybrowser\application.ini 11. Press the Apply button if necessary to save your new selection 12. Close the Project Properties dialog box
Debugging MyBrowser
You are now ready to begin debugging your XULRunner build.
1. From the Visual Studio 2005 Build menu, select the Deploy Solution menu item 2. Wait for the Windows Mobile 6 Standard Emulator has start 3. In the Emulator's File menu, select the Configure... menu item 4. Press the ... button for the Shared Folder edit box 5. Select the c:\mozilla\unicode\objdir-wm6-debug\dist directory 6. Close the Emulator Properties dialog box by pressing the OK key 7. In the Visual Studio 2005's Debug menu, select the Start Debugging menu item
You should now see the Visual Studio begin a debugging session of XULRunner loading the MyBrowser XULApp.
Other Tips
1. Color scheme for MingW32 Command Line Prompt
I hated the default color scheme for the command prompt under MingW32 - so I changed it. Find the file c:\mozilla-build\msys\etc\profile, and edit the lines (toward the bottom) which export PS1, and make them say:
export PS1='\[\033]0;$MSYSTEM:\w\007 \033[34m\]\u@\h \[\033[31m\w\033[0m\] $ '
This changed the directory color to something I could actually see against a white background.
3. Further Setting Up MingW32 Path
I get annoyed with continually adding the path to the Mercurial HG.EXE, as well as continually adding the path to the build's wince tools directory.
So I created a c:\mozilla-build\msys\etc\profile.d\profile-setup-hg.sh file, containing:
#!/bin/sh export PATH="$PATH:/c/progra~1/Mercurial" # This is an addition to get the shim cross-compile build tools into # our path. - jvw 24-Apr-08 export PATH="$PATH:/c/mozilla/unicode/build/wince/tools/vs8ppc2003arm"
This sets up my HG.EXE path, as well as the path to my WinCE build tools (arm-wince-as.exe, arm-wince-gcc.exe, arm-wince-lib.exe, and arm-wince-link.exe)