Gtkmm 3.0 in Ubuntu 11.04



Lately I've been writing a lot of codes using gtkmm 3.0. The latest stable branch is 2.4, but this is based on GTK+ 2… and I really want to use GTK+ 3. Why? Because GTK+ 3 uses cairo for it's native drawing API, and cairo is sweet. gtkmm uses cairomm, which is even sweeter. So here are my notes on getting gtkmm-3 built and installed for Ubuntu 11.04. I've written a shell script to do all the work, but I'll go through it section by section to explain what's going on.

Setup

Traditionally /usr/ is used for normal system stuff /usr/local is for experimental stuff (it's essentially the same as /usr but it makes it easy to find and remove stuff after it breaks your system). However, since I originally was developing with the unstable Gtkmm branch in Ubuntu 10.04, which didn't even have a package for GTK+ 3 in the repositories, I started installing things into my home directory… since it's just for testing anyway. Therefore, I create a directory $HOME/Codes/devroot (for development root filesystem) where I install all the "unstable" packages I'm using, or where I practice-install the programs/libraries I'm writing.

I also make a directory $HOME/Codes/cpp/gnome where I download all the source tarballs and do the building.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/bin/bash
cd $HOME

export BASE=$HOME/Codes/devroot
export PATH=$BASE/bin:$PATH
export LD_LIBRARY_PATH=$BASE/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$BASE/lib/pkgconfig:$PKG_CONFIG_PATH
export XDG_DATA_DIRS=$BASE/share:$XDG_DATA_DIRS
export ACLOCAL_FLAGS="-I $BASE/share/aclocal $ACLOCAL_FLAGS"

mkdir -p $BASE
mkdir -p Codes/cpp/gnome
cd Codes/cpp/gnome

Next I export some variables containing the versions of the unstable packages I'm using. This is so that I can quickly update the script for future installations and things.

export MM_COMMON_VER=0.9.5
export GLIBMM_VER=2.28.1
export ATKMM_VER=2.22.5
export PANGOMM_VER=2.28.2
export CAIROMM_VER=1.1.10
export GTKMM_VER=3.0.1

Then I download all the source tarballs

wget http://ftp.acc.umu.se/pub/GNOME/sources/mm-common/0.9/mm-common-$MM_COMMON_VER.tar.gz
wget http://ftp.acc.umu.se/pub/GNOME/sources/glibmm/2.28/glibmm-$GLIBMM_VER.tar.gz
wget http://ftp.acc.umu.se/pub/GNOME/sources/atkmm/2.22/atkmm-$ATKMM_VER.tar.gz
wget http://ftp.acc.umu.se/pub/GNOME/sources/pangomm/2.28/pangomm-$PANGOMM_VER.tar.gz
wget http://ftp.acc.umu.se/pub/GNOME/sources/gtkmm/3.0/gtkmm-$GTKMM_VER.tar.gz
wget http://cairographics.org/snapshots/cairomm-$CAIROMM_VER.tar.gz

And extract them all into $HOME/Codes/cpp/gnome (currently PWD).

tar xvzf mm-common-$MM_COMMON_VER.tar.gz
tar xvzf glibmm-$GLIBMM_VER.tar.gz
tar xvzf atkmm-$ATKMM_VER.tar.gz
tar xvzf pangomm-$PANGOMM_VER.tar.gz
tar xvzf gtkmm-$GTKMM_VER.tar.gz
tar xvzf cairomm-$CAIROMM_VER.tar.gz

Then we start installing the packages in the appropriate order. There are a few ugly things that we have to do in the process though.

cd mm-common-$MM_COMMON_VER
./configure -prefix=$BASE
make -j6
make install
cd ..

cd glibmm-$GLIBMM_VER
./configure -prefix=$BASE
make -j6
make install

The first ugly thing is that the glibmm package doesn't install the doctool perl script like it should… so we have to do that manually:

mkdir -p $BASE/share/glibmm-2.4/doctool/
cp docs/doc-install.pl $BASE/share/glibmm-2.4/doctool/

Then we continue installing the libraries

cd ..

cd atkmm-$ATKMM_VER
./configure -prefix=$BASE
make -j6
make install
cd ..

cd pangomm-$PANGOMM_VER
./configure -prefix=$BASE

The second ugly thing we have to do is move libfreetype.la to where libtool can find it. I'm not sure why it can't find this specific library but for whatever reason, even after setting LD_LIBRARY_PATH it always looks in /usr/lib. So I just pretend like no ones watching and create a symlink.

sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.la /usr/lib/

And everything after that goes pretty normally.

make -j6
make install
cd ..

cd cairomm-$CAIROMM_VER
./configure -prefix=$BASE
make -j6
make install
cd ..

cd gtkmm-$GTKMM_VER
./configure -prefix=$BASE
make -j6
make install
cd ..

Comments


Comments powered by Disqus