Collabora Notes

From MozillaWiki
Jump to navigation Jump to search

These are helpful tips, made by Collaborans, for those struggling to build Mozilla sources on different platforms.

Collaborans are interested in building code from the Electrolysis project (E10s) on a machine on which Scratchbox is also installed, on which the Maemo SDK is installed, and on which one can cross-compile to the ARM architecture.

XEN IMAGES

One route to a working build environment is via a pre-configured virtual machine image. robin_bb has developed two such images. Each is Linux-based.

Mozilla Central on Debian 5.0 32-bit i386

The Xen image called "lenny-32-mc" (1.1GB) is a Debian 5.0 ("Lenny") installation on top of a 32-bit i386 Xen VM. It has a copy of the Mozilla Central code repository, and all of the Debian packages required to build that. The root password is "Collabora".

To use that image, you'll need the Xen virtual machine. While installing Xen is quite an ordeal, it is significantly easier than configuring the build environment described above!

Maemo + Scratchbox + E10s + on Debian 5.0 32-bit i386

Coming soon.

VIRTUALBOX IMAGE

Request from robin_bb.

MANUAL SETUP

For those who don't have proper setup or recommended OS to install the provided Xen images -- or for those who want to understand the odds of setting up a cross-platform development environment for the mozilla codebase -- the following are three step-by-step guides focussing on building the Electrolysis projects (e10s) under three different platforms, namely linux, maemo and win32.

Important considerations when using scratchbox

If you are interested in building electrolysis specifically for only one of the abovementionned platforms, then you can just go right to the proper section hereunder and follow the steps from there. However, if you intend to build for the maemo platform (using scratchbox) along with any (or both) of the other platforms, then, you might want to start setting up your maemo environment first and be sure to put the Mozilla sources somewhere under the /scratchbox directory. Preferably, something like :

/scratchbox/users/<your_username>/home/<your_username>/mozilla/e10s

In fact, because Scratchbox performs "chroot" on the /scratchbox directory at startup, all other system directories outside of /scratchbox, including home/, will become unreacheable for all scratchbox sessions. This chroot operation is essential for seamless cross-compilation and in fact, comes in very handy.

This way, you'll be able to use this one and only codebase for all of your maemo, linux and win32 platform builds. Of course, to make your cross-platform environment even more seamless, a very good idea is to create symbolic links that map to your /scratchbox/... working dirs, as follows:

cd /home/<your_username>
ln -s /scratchbox/users/<your_username>/home/<your_username>/mozilla mozilla 

Building e10s under linux

Supported Linux versions

The mozilla source supports many linux flavors, but the most common ones among Mozilla developers are Debian/Ubuntu. See this page for a list of the supported distros.

Installing build dependencies

Many third-party libraries are necessary to build the mozilla codebase. Depending on your linux distro, you can find all the commands to properly install the linux prerequisites in here.

Mozconfig

For general information on how to create mozconfig files, read this.

Alternatively, here are two examples of mozconfig that you can use directly :

#DEBUG build under linux<br> 

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdirs/DEBUG_LINUX_X86
mk_add_options MOZ_BUILD_PROJECTS="browser"
ac_add_app_options browser --enable-application=browser 

ac_add_options --disable-optimize
ac_add_options --enable-debug
ac_add_options --enable-debugger-info-modules 
ac_add_options --disable-tests
ac_add_options --disable-crashreporter
#RELEASE build under linux<br> 

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdirs/RELEASE_LINUX_X86
mk_add_options MOZ_BUILD_PROJECTS="browser"
ac_add_app_options browser --enable-application=browser

ac_add_options --enable-optimize 
ac_add_options --disable-debug
ac_add_options --disable-tests

Pulling the electrolysis project

Building e10s

Building e10s under maemo

Installing Scratchbox Apophis

NOTE: There are actually two scratchbox versions supported by Nokia, namely Scratchbox 1.0 (Apophis) and Scratchbox2. Both allow electrolysis to build under maemo for ARM processors, but this document will only pertain to version 1.0. See Maemo 's scratchbox for maemo 6 wiki page.

Install from your regular repositories

If you're running DEBIAN or UBUNTU, there's good chances that your distro's repositories keep an up-to-date version of Scratchbox Apophis. If so, install it throught the package manager and all relevant devkits and toolchains suggested in here.

Install manually from files.maemo.org

In any other cases, you can also manually install Scratchbox 1.0.

For that, you need Scratchbox Apophis.

Once you have scratchbox installed, you can clone the mozilla codebase repository.

If you want to build the code for different platforms and different processors, we really recommend that you put the codebase somewhere *UNDER* the /scratchbox directory, because scratchbox console is chroot'ed to the /scratchbox.

Best location is /scratchbox/users/<username>/home/<username>/mozilla/


Note:

The scratchbox '_X86' targets don't add extra value to the build and since your SB build environment might not be as complete  So there's really little need for the XXX_X86 targets in Scratchbox. When you want to build for X86 processors, do it directly from your preferred linux console.

Installing Maemo SDK

As a Collabora developer, you might be targetting a specific maemo platform version.

Pulling the electrolysis project

Installing missing libs

Building e10s

Building e10s under win32

Installing dev. environment

Installing ext3 fileSystem

Setting MSVC up

Pulling the electrolysis project

Building e10s

Common steps to all three platforms

Pulling the electrolysis project

The electrolysis repository is a parallel branch to the "mozilla-central" branch, from which the main Mozilla apps are built (firefox, thunderbird, etc...).

You must have Mercurial installed on your system to clone the electrolysis repository.

Do the following :

hg clone http://hg.mozilla.org/projects/electrolysis e10s

This will create the "e10s" directory under the current directory.

Building the electrolysis project

Notes on Building

IPDL

When adding the first IPDL files to a Mozilla component, one must ensure that the following lines are added to the (sub)component's Makefile.in:

include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk

Also, make sure prtypes.h is NEVER included before basictypes.h, as the definition of int32 is different (int/long). You'll get an unresolved external error while linking otherwise, complaining the IPC::Message constructor is not found.

XPIDL

When changing an .idl file, one must always rebuild "from top", because it's very likely that some other component (that you did not recompile) is making use of your modified .idl interface, thus leading to vtable problems and crashes.