Friday 11 October 2019

How to install Meld on Ubuntu

Meld is popular cross-platform visual diff and merge tool. It can compare files and directories.

Clone Meld repository (use HTTPS URI, not the SSH-based one unless you've set up SSH key for that repo):

$ git clone https://gitlab.gnome.org/GNOME/meld.git

Check the status of master and release branches. When I built and run the app from master, I got this error:

$ meld
Meld requires GtkSourceView 4 4.0.0 or higher.




Then I found the following comment here:
> If Meld is complaining about GtkSourceView 4, you're using master, not 3.20.1.

This means I should have checked out the release branch for the desired version:

$ cd meld/
$ git checkout meld-3-20

When I was running the installer:

$ python3 setup.py install --prefix=/usr

...I was getting errors related to missing packages:

unable to execute 'intltool-update': No such file or directory
error: command 'intltool-update' failed with exit status 1

unable to execute 'xmllint': No such file or directory
error: command 'xmllint' failed with exit status 1

unable to execute 'glib-compile-resources': No such file or directory
error: command 'glib-compile-resources' failed with exit status 1

I installed the required packages (the package needed for xmllint is libxml2-utils):

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install intltool 
$ sudo apt install xmllint
E: Unable to locate package xmllint
$ sudo apt install libxml2-utils
$ glib-compile-resources --help
Command 'glib-compile-resources' not found, but can be installed with:
sudo apt install libglib2.0-dev-bin
$ sudo apt install libglib2.0-dev-bin

...and run again installer:

$ python3 setup.py install --prefix=/usr

...which now complained about permissions:

creating /usr/lib/python3/dist-packages/meld
error: could not create '/usr/lib/python3/dist-packages/meld': Permission denied

Meld was finally installed with sudo user:

$ sudo python3 setup.py install --prefix=/usr
...
running install_egg_info
Writing /usr/lib/python3/dist-packages/meld-3.21.0.egg-info

When I run it first time I got this error:

$ meld
Meld requires pygobject 3.30.0 or higher.




To install the latest version of PyGObject:

$ pip3 install PyGObject 

Installing PyGObject complained couple of times about missing packages:

No package 'glib-2.0' found
Try installing it with: 'sudo apt install libglib2.0-dev'

No package 'gobject-introspection-1.0' found
Try installing it with: 'sudo apt install libgirepository1.0-dev'

No package 'cairo' found
Try installing it with: 'sudo apt install libcairo2-dev'

Installing PyGObject was successful once I installed all missing packages:

$ sudo apt install libglib2.0-dev
$ sudo apt install libgirepository1.0-dev
$ sudo apt install libcairo2-dev
$ pip3 install pycairo

I rebuilt the app and run it again:

$ sudo python3 setup.py install --prefix=/usr
$ meld

This time it opened with no issues:


References:

2 comments:

Unknown said...

i got this error
"Meld requires GtkSourceView 4.0 or higher"

said...

This article is really helpful !!

to the committer, I think you missed to checkout 3-20, all the install is for this version.