Clutter Wiki

Views
From ClutterProject
Jump to: navigation, search

Contents

Setting up an isolated Gnome3/ Clutter development environment

This page describes how to set up Gnome 3 and Clutter using jhbuild. The environment will be isolated, it will not interfere with your usual desktop environment. The procedure is tailored to and was tested on Ubuntu Linux (Ubuntu 11.10).

The relationship between Gnome 3 and Clutter is that Clutter is the core of the Gnome 3 window manager and all the graphic output. It sits right above xlib/ xcb and GDK.

The purpose of this page is also to explain the What and Why of the build process.

About jhbuild

jhbuild is the official Gnome build tool. It takes care of downloading the source code, configuring and installing of all Gnome modules. It is not a package manager, think of it as a frontend combining the Unix development tools to provide you with a simple (once it's working) way of developing with and for Gnome.

It's for GCC/ Gnome what Maven is for Java/ Apache.

Preparing your System

Utility Packages

These are needed mostly by jhbuild, some are runtime requirements of some Gnome 3 modules.

sudo apt-get git-core subversion mercurial bzr cvs \
autotools gnome-common gnome-doc-utils mesa-utils

Development libraries

Some developement libraries are not part of Gnome and thus not provided by jhbuild. Installing them selectively is highly recommended.

Note: these packages are what you need to compile and run Clutter, for building the whole Gnome 3 suite the list is much larger.

Installing Selectively

Install only the needed development packages. The problem is that these vary from system to system so you may have to install some more packages if jhbuild complains. This is a list of packages I have installed on my system:

sudo apt-get install autotools-dev gsettings-desktop-schemas-dev libavahi-client-dev \
libavahi-common-dev libc-dev-bin libc6-dev libcups2-dev libcurl4-openssl-dev \
libdb5.1-dev libdbus-1-dev libdconf-dev libexpat1-dev libffi-dev libfontconfig1-dev \
libfreetype6-dev libgdbm-dev libgl1-mesa-dev libice-dev libicu-dev libidn11-dev libiw-dev \
libjpeg62-dev libkrb5-dev libldap2-dev libltdl-dev libogg-dev libopts25-dev libpam0g-dev \
libpciaccess-dev libpixman-1-dev libpng12-dev libppd-dev libpthread-stubs0-dev libsm-dev \
libssl-dev libstdc++6-4.6-dev libtasn1-3-dev libtiff4-dev libtinfo-dev libudev-dev \
libusb-1.0-0-dev libusb-dev libvorbis-dev libx11-dev libx11-xcb-dev libxau-dev \
libxcb-render0-dev libxcb-shm0-dev libxcb-util0-dev libxcb1-dev libxcomposite-dev \
libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev libxft-dev libxi-dev libxkbfile-dev \
libxml2-dev libxrandr-dev libxrender-dev libxt-dev libxtst-dev linux-libc-dev mesa-common-dev \
ppp-dev python2.7-dev tcl-dev tcl8.5-dev uuid-dev x11proto-composite-dev x11proto-core-dev \
x11proto-damage-dev x11proto-dri2-dev x11proto-fixes-dev x11proto-fonts-dev x11proto-input-dev \
x11proto-kb-dev x11proto-randr-dev x11proto-record-dev x11proto-render-dev x11proto-video-dev \
x11proto-xext-dev x11proto-xinerama-dev xserver-xorg-dev xtrans-dev zlib1g-dev

Installing with Brute Force

You could also just install the Gnome 3 development packages from Ubuntu. Beware! This will install Gnome 3, and since this is Ubuntu, you will get all sorts of configuration changes you possibly do not want, a new display and login manager being the least problematic. You will also get tons of packages you don't need. However, if you already use Gnome 3 or just want to have it all in one go, this may suit you.

sudo apt-get install libgnome-control-center-dev

Last and Least

Reboot now. Because apt-get often updates initramfs when installing lots of packages, this way you can verify that nothing has borked your system. It's important to check that everything is fine at this stage.

Preparing the File System

You will need 2 new directories: one where Gnome 3 (and thus Clutter) will be built into, called the gnome3 directory, and another to where the source code will be checked out to, called the checkout directory. Both directories must be writable by you. I'm using /opt/gnome3 and /opt/checkout, that way every user account has at least read access to it and can use it:

sudo mkdir /opt/gnome3
sudo chown zaphod:zaphod /opt/gnome3

sudo mkdir /opt/checkout
sudo chown zaphod:zaphod /opt/checkout

Change zaphod to your user name.

Seting up jhbuild

Once jhbuild is set up, building any Gnome module becomes much easier than the good old ./configure && make && make install procedure. However, this is just a short summary, for a detailed description see the fine manual.

Get it

Get the source code and put it into the checkout directory. Do not use jhbuild from your distribution!

cd /opt/checkout
git clone git://git.gnome.org/jhbuild

Build it

Using the glorious triad directly for the last time.

cd /opt/checkout/jhbuild
./autogen.sh
./make
./make install

Jhbuild installs it's start script into ~/.local/bin, put this directory into your PATH:

echo PATH=$PATH:~/.local/bin >> ~/.bashrc

Configure it

As last step, tell jhbuild where your gnome3 and checkout directories are. This is done via the configuration file ~/.jhbuildrc. Copy/ paste this into a new file called, well, ~/.jhbuildrc

# -*- mode: python -*-
# -*- coding: utf-8 -*-
checkoutroot = '/opt/checkout'
prefix = '/opt/gnome3'

Validate and complete the installation with:

jhbuild sanitycheck
jhbuild bootstrap
jhbuild sanitycheck

Done. Have a walk or a drink, this was tough work.

Building Clutter and it's dependencies

Now that everything is prepared, you can actually build clutter. Depending on your machine, this can take hours. Clutter and Cogl take a very short time to build, but so do the gazillion other packages you need in order to build them. Make sure you have at least around 10GB of free space, some checkouts are really large.

The One Command

jhbuild build clutter

If that ran through without any error, grab a bottle of champagne and consider yourself a very lucky person. My crystal ball tells me it didn't.

General Troubleshooting

Regardless what kind of error you get, these should be tried first.

Checking jhbuild

It's a good idea to check your jhbuild installation from time to time:

jhbuild bootstrap
jhbuild sanitycheck

Checking packages

Since Ubuntu knows nothing about jhbuild and Gnome 3, you often accidentally remove some important packages when doing apt-get autoremove. Run the commands from BuildingGnome3ClutterOnLinux#Get_prerequisite_Packages, just in case.

Updating jhbuild

Always keep jhbuild up to date:

cd /opt/checkout/jhbuild
make update
make
make install

Streamlining the Process

Since this is going to be a try-and-error process, you need to reduce the compile time and clean up the console output so you only see what's important. Edit your configuration file (~/.jhbuildrc):

# -*- mode: python -*-
# -*- coding: utf-8 -*-
checkoutroot = '/opt/checkout'
prefix = '/opt/gnome3'

# Keeps your system responsive while compiling [1]
nice_build = 				True

# Override some make arguments                 [3]
makeargs = 				'-j 1'

# Override some c and c++ compiler options     [2]
os.environ['CFLAGS'] = 			'-w -O0 -Wno-error'
os.environ['CPPFLAGS'] = 		'-w -O0 -Wno-error'

[1] Lets jhbuild run as a low priority process. This doesn't really effect compile time, but you may want to do something on your computer while it's compiling.

[2] Sets the number of cores to use for make, change the value to the number of cores you have.

[3] Disables all optimizations (faster compilation) and disables all warnings. The latter is usually a bad practice, but since this is about building and not debugging modules, it's better to keep the console clean but still see what's going on. -Wno-error makes sure that no warning whatsoever gets treated as an error and breaks a build. Some modules use -Werror without providing --disable-error.

Separating Checkout from Building

Gnome 3 is under heavy development. Since a complete build can span several hours on slow machines, it's not that uncommon that you get some clashes.

Update/ checkout all needed modules in one go:

jhbuild update clutter

Building without updating:

jhbuild build --no-network

Tabula Rasa

Before going into detailed troubleshooting mode you should start from scratch. This does not mean you have to do everything again. But it does mean that you should not put anything of value in the gnome3 (/opt/gnome3) or the checkout (/opt/checkout directory.

cd /opt/gnome3
rm -rvf *
cd /opt/checkout
rm -rfv *
git clone git://git.gnome.org/jhbuild
cd jhbuild
./autogen.sh
make
make install
cd ~ 
jhbuild bootstrap
jhbuild sanitycheck

That is a rather drastic method in contrast to use jhbuild uninstall, but it's good to know that you are really starting from scratch.

In Depth Troubleshooting

TBD

Using the llvm-clang Compiler

This greatly speeds up compilation.

TBD

Personal tools