Linux Build Prerequisites

Video Tutorial

If you prefer annotated videos to wiki pages, there is one available for Linux users.

Hardware

  • 2G RAM with lots of available swap space. Additional RAM will significantly decrease build time.
  • For debug builds: at least 8 GB free disk space
  • For optimized builds: at least 1 GB free disk space (6 GB recommended)

Build Tools and Dependencies

All Distros - One Line Bootstrap Command

Try to run the following to install all system prerequisites:

wget https://hg.mozilla.org/mozilla-central/raw-file/default/python/mozboot/bin/bootstrap.py && python bootstrap.py

If this doesn't work, continue on to one of the sections below.

Ubuntu

You can download and install all the prerequisites with the following command:

sudo apt-get install zip unzip mercurial g++ make autoconf2.13 yasm libgtk2.0-dev libglib2.0-dev libdbus-1-dev libdbus-glib-1-dev libasound2-dev libcurl4-openssl-dev libiw-dev libxt-dev mesa-common-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libpulse-dev

libcurl4-openssl-dev is only required to build the crash reporter. If you are using the --disable-crashreporter config option, then you don't need to install this.

These instructions will install the default compiler for your current Ubuntu release. If you would prefer to use GCC 4.6, then this is available in Ubuntu 12.04 and newer. If you are using Ubuntu 12.10 or newer, you will need to install it manually with:

sudo apt-get install g++-4.6

If you do this, remember that you need to set CC and CXX in your environment to point to the correct compiler.

Debian

You can download and install all the prerequisites with this command (as root):

sudo aptitude install zip mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev libidl-dev mesa-common-dev autoconf2.13 yasm libgtk2.0-dev libdbus-1-dev libdbus-glib-1-dev python-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libpulse-dev

If you are running a chroot environment, or a minimalist installation, you may also need to install some basic packages:

aptitude install unzip gcc g++ make patch 

Debian Squeeze additions

On Debian Squeeze, you need to install yasm-1.x from squeeze-backports. You can also get mercurial if you need compatibility with an exisiting mercurial 2.x repository.

echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> /etc/apt/sources.list
aptitude update
aptitude -t squeeze-backports install yasm mercurial

Debian Squeeze has only Python 2.6, and Mozilla build system asks for Python 2.7. Although Python 2.7 is in Debian Wheezy and mixing Debian packages from different releases can be done with apt pinning, it's not recommended because it can make your system unstable, and you will have a lot of dependencies problems.
The easiest solution is to use pythonbrew.

# Make sure you have libbz2-dev installed before, it's needed to have bz2 module in Python.
aptitude install libbz2-dev

# Install pythonbrew like described in the documentation
curl -kL http://xrl.us/pythonbrewinstall | bash

# Install Python 2.7 and make it the default
pythonbrew install 2.7.3
pythonbrew switch 2.7.3

# Check version
python --version

openSUSE/SUSE Linux Enterprise

Execute the following command (as root):

zypper install \
  make cvs mercurial zip gcc-c++ gtk2-devel xorg-x11-libXt-devel libidl-devel \
  freetype2-devel fontconfig-devel pkg-config dbus-1-glib-devel mesa-devel \
  libcurl-devel libnotify-devel alsa-devel autoconf213 libiw-devel yasm \
  gstreamer010-devel gstreamer010-plugins-base-devel pulseaudio-devel

RedHat Enterprise Linux (RHEL)/CentOS/Fedora

Execute the following command:

sudo yum groupinstall 'Development Tools' 'Development Libraries' 'GNOME Software Development'
sudo yum install mercurial autoconf213 glibc-static libstdc++-static yasm wireless-tools-devel mesa-libGL-devel alsa-lib-devel libXt-devel gstreamer-devel gstreamer-plugins-base-devel pulseaudio-libs-devel
# 'Development tools' is defunct in Fedora 19 use the following
sudo yum groupinstall 'C Development Tools and Libraries'
sudo yum group mark install "X Software Development"

 

RHEL/CentOS do not include Mercurial in their repositories. You can install a RPM package directly from RPMForge (http://packages.sw.be/mercurial/) using the following commands (replace VERSION with the right string for your version/architecture):

wget http://packages.sw.be/mercurial/mercurial-VERSION.rpm
rpm -Uhv mercurial-VERSION.rpm

If you have already added the RPMForge repositories to your system, a simple yum install mercurial should work as well.

Arch Linux

Install the following packages:

pacman -Syu --needed base-devel zip unzip freetype2 fontconfig pkg-config gtk2 dbus-glib iw libidl2 python2 mercurial alsa-lib curl libnotify libxt mesa autoconf2.13 yasm wireless_tools gstreamer0.10 gstreamer0.10-base-plugins libpulse

Python

Note that Python3 is the default python in Arch Linux, but Mozilla requires python2, which is installed above. There are a few ways to work around this. One is to add

mk_add_options PYTHON=/usr/bin/python2

to your .mozconfig file, and compile by running the mozilla build utility (mach) as a python2 script (which it is):

python2 mach build

Don’t try things like creating a symbolic link to python2 with the name python, as this will break many other applications that makes assumptions about what version plain python refers to.

Autoconf

The default autoconf version in Arch is currently 2.69, but Mozilla requires 2.13, which is installed above (Note the executable is named differently than the package). Add this line to your .mozconfig file:

mk_add_options AUTOCONF=autoconf-2.13

All other systems

On other systems, you can install the tools individually:

mkdir ~/bin
ln -sf `which python2` ~/bin/python
  • A recent POSIX Shell
  • A C++ compiler. GCC 4.6 or higher is recommended, or your platform's native C/C++ compiler. Compilers older than GCC 4.4 will probably not work.
  • Perl 5.6 or higher. Older perl versions may work if you upgrade File::Spec to version 0.8
  • GNU make 3.80 or higher. Other varieties of "make" will not work.
  • the GTK2 widget toolkit, version 2.10 or higher
  • libXt-devel for X11/Intrinsic.h, X11/Shell.h
  • libIDL 0.6.3 or higher Source snapshots are available from Mozilla via ftp. If using the RPMs, you'll need both the regular rpm and the -devel rpm. If you already have ORBit installed, then you do not need to install libIDL as ORBit bundles libIDL. You may need to install the ORBit-devel package if you use packages.
  • zip 2.3 (or higher)
  • freetype 2.1.0 (or higher)
  • fontconfig
  • libgstreamer 0.10 (or higher) and its base plugins
  • pkg-config 0.9.0 (or higher)
  • dbus-1-glib-devel (Developer package for D-Bus/GLib bindings)
  • libasound2-dev (needed for audio playback support)
  • pulseaudio-libs-devel (preferred for audio over ALSA)
  • libnotify-dev
  • Yasm version 1.1.0 or newer.
  • Python 2.7.3 or later. Python 3 will not work.
  • autoconf-2.13 (requires GNU m4) - Autoconf 2.5x will not work. See bug 104642 for details.

To install autoconf-2.13 from source:

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz
tar -xvzf autoconf-2.13.tar.gz
cd autoconf-2.13/
./configure --program-suffix=2.13
make
sudo make install

You may need to export AUTOCONF=autoconf2.13 in your environment (e.g. put it in .profile in your home directory) or add this line to your .mozconfig file:

mk_add_options AUTOCONF=autoconf2.13

Additional Information

Document Tags and Contributors

Contributors to this page: Benjamin Smedberg
Last updated by: Benjamin Smedberg,