Latest Tweets

Compile that fancy old version on your newer GNU/Linux Distro!

The issue

So you have installed the latest GNU/Linux Debian release, i.e. Jessie, and all of a sudden you have to deal with the new Gedit, Evince, and the like with such awful GUI, right? Not anymore! It is always feasible to compile and run older versions on newer distros, and the other way around sometimes too!


In this example, we will be dealing with the compilation procedure for the previous Gedit release, i.e. 3.4.2, that comes out-of-the-box with Debian Wheezy. First you need to get the Debian Wheezy sources for the gedit package (of course, you can do this on a real computer or using a Virtual Machine):

# apt-get source gedit

Upload the entire source tree to your Debian Jessie Box:

# scp -R gedit-3.4.2 user@your_debian_jessie_box

Before going any further, you need to install the build dependencies for gedit in your Jessie distro:

# apt-get build-dep gedit

Preparing the sources

The Debian Build System will be leveraged so that we can compile the previous gedit version but not as a binary package. This way we can install gedit 3.4.2 version in a separate directory and avoid interfering with the one already installed on Jessie. Therefore, edit the debian/rules file inside the gedit-3.4.2 source tree and make sure you add this new flag to the DEB_CONFIGURE_EXTRA_FLAGS variable (in bold):

DEB_CONFIGURE_EXTRA_FLAGS += –disable-scrollkeeper –enable-gtk-doc –prefix=/usr/local/gedit-3.4.2

After that, you can build the sources by typing:

# cd gedit-3.4.2 && debian/rules build

An error shows up

During the building process, an error shows up and the compilation stops:

gedit-window.c:902:2: error: implicit declaration of function ‘gtk_source_language_get_section ‘ [-Werror=implicit-function-declaration]
263 section = gtk_source_language_get_section (lang);

This error, in fact, will be showing up in different source files. This is so because we are now using version 3.0 of the GTK libraries, and the function gtk_source_language_get_section is declared in the header file <gtksourceview/gtksource.h>. Therefore, you have to add these lines to each source file that fails to compile due to this error:

#if GTK_CHECK_VERSION (3, 0, 0)
#include &lt;gtksourceview/gtksource.h&gt;

After adding these lines in the following files: gedit/gedit-window.c , gedit/gedit-preferences-dialog.c, gedit/gedit-file-chooser-dialog.c and plugins/modelines/modeline-parser.c , you are ready to go:

# debian/rules build

This time the building process ends with no errors at all. In order to install this version of gedit, you type:

# make install

The previous command will install gedit 3.4.2 in a separate directory under /usr/local/gedit-3.4.2. Notice, though, that the binary package has not been built, so you can safely use both versions (and still be applying updates to the gedit version installed with Jessie).

Executing gedit 3.4.2

If you run this binary on a Debian Jessie box, you’ll get this error and the program stops:

(gedit.wheezy:25394): GLib-GIO-ERROR **: Settings schema ‘org.gnome.gedit.preferences.ui’ does not contain a key named ‘notebook-show-tabs-mode’

To circumvent this error you need to set the GSETTINGS_SCHEMA_DIR variable accordingly, so that it points to the /usr/local/gedit-3.4.2/share/glib-2.0/schemas directory. Besides, you need to set the LD_LIBRARY_PATH variable accordingly too. The best way to achieve this is by writting a simple wrapper like this:

export LD_LIBRARY_PATH=/usr/local/gedit-3.4.2/lib/gedit:/usr/local/gedit-3.4.2/lib/pkgconfig
export GSETTINGS_SCHEMA_DIR=/usr/local/gedit-3.4.2/share/glib-2.0/schemas
/usr/local/gedit-3.4.2/bin/gedit "$@"
exit $?

Now, if you execute this wrapper, Gedit 3.4.2 will run with no issues at all. Below, a screen-shot taken on a Debian Jessie GNU/Linux box running gedit 3.4.2 and showing the /etc/debian_version file.

Gedit 3.4.2 (Wheezy) running on a Debian Jessie distro.

Gedit 3.4.2 (Wheezy) running on a Debian Jessie distro.