2

I am attempting to build the latest version of Meld on Ubuntu 20.10.

I have followed the instructions at https://github.com/GNOME/meld, ensuring I have the necessary packages for my system.

# Enabled "source code" in Sources & Updates.
sudo apt install git build-essential meson ninja-build gettext libgtk-3-dev python-gi-dev python3-cairo-dev appstream-util libgtksourceview-4-dev
sudo apt-get build-dep meld

git clone https://github.com/GNOME/meld.git
cd meld
meson _build
cd _build
ninja
ninja install

Everything goes fine, but when I attempt to run meld, I get the following error

cd ~
meld
Traceback (most recent call last):
  File "/usr/local/bin/meld", line 97, in <module>
    import meld.conf  # noqa: E402
ModuleNotFoundError: No module named 'meld'

I suspect this has something to do with where the files were installed on my system.

I can see that meld was installed to /usr/local/lib/python3.8/site-packages/ while I was expecting it to install to /usr/share.

Additionally, I was expecting the executable to be placed in /usr/bin but it is in /usr/local/bin. which meld /usr/local/bin/meld

What am I doing wrong?

Enterprise
  • 12,002
  • 11
  • 60
  • 105

1 Answers1

2

Analysis

There are some issues with the method from official README.

Moreover - following PKGBUILD from ArchLinux on Ubuntu with steps below

cd /tmp
git clone https://github.com/GNOME/meld.git
cd meld
python3 setup.py build
sudo python3 setup.py --no-update-icon-cache --no-compile-schemas install --prefix=/usr/local --optimize=1

does not lead to positive result either. It ends with already seen error:

$ meld
Traceback (most recent call last):
 File "/usr/local/bin/meld", line 97, in <module>
   import meld.conf  # noqa: E402
ModuleNotFoundError: No module named 'meld'

Solution

We need to utilize the deb-src package building procedure to latest source code from git repository.

In step-by-step style it will look as follows:

sudo apt-get install git build-essential gettext libgtk-3-dev python-gi-dev python3-cairo-dev appstream-util libgtksourceview-4-dev dpkg-dev python3-pytest
sudo apt-get build-dep meld

cd ~/Downloads
git clone https://github.com/GNOME/meld.git
cd meld

wget http://archive.ubuntu.com/ubuntu/pool/universe/m/meld/meld_3.20.2-2.debian.tar.xz
tar -xf meld_3.20.2-2.debian.tar.xz
mv meld_3.20.2-2.debian.tar.xz ../

sed -i "s|meld.1|data/meld.1|" debian/meld.manpages
sed -i "s|3.20.2-2|$(git describe --tags | sed 's/-/+/g')|" debian/changelog

dpkg-buildpackage -b -uc -us

then finally install the package with:

sudo apt-get install ../meld_3*_all.deb

and check its version:

$ meld --version
meld 3.21.1
N0rbert
  • 97,162
  • 34
  • 239
  • 423
  • See update above. I have built the deb-package using pybuild. Did comments cleanup. The method is applicable for 20.04 LTS. So I would recommend to continue using it, to get long support cycle. – N0rbert Dec 28 '20 at 20:42
  • I really appreciate you going through the extra trouble to figure this out. It works flawlessly! Did you mean `gdebi` or `dpkg -i` for the install command? (In my case, I also needed to install dependencies `gir1.2-gtksource-3.0`, `libgtksourceview-3.0-1`, and `libgtksourceview-3.0-common`). – Enterprise Dec 28 '20 at 21:45
  • The `dpkg -i` do not resolve dependencies. So `gdebi` / `gdebi-gtk` or `apt / apt-get` are better. You are welcome. I would recommend to remove unneeded comments above. It was interesting investigation. – N0rbert Dec 28 '20 at 21:51