2

I have installed ldoce5 viewer on Ubuntu 18.04 and Ubuntu 16.04 following this guide before with no problem at all, but now I have installed Ubuntu 20.04.

And so I wanted to install ldoce5 viewer following the same guide, but I it seems that some required packages for installing ldoce5 viewer, are missing or deleted from Ubuntu 20.04 repository, and therefor I can not install ldoce5 viewer.

So now that Ubuntu 20.04 has been released, How can we install this dictionary on it, without using Wine?

EDIT: and my output is

mustafa@T440p:~$ export | grep SESSION
declare -x DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus"
declare -x DESKTOP_SESSION="ubuntu"
declare -x GDMSESSION="ubuntu"
declare -x GNOME_DESKTOP_SESSION_ID="this-is-deprecated"
declare -x GNOME_SHELL_SESSION_MODE="ubuntu"
declare -x SESSION_MANAGER="local/T440p:@/tmp/.ICE-unix/8283,unix/T440p:/tmp/.ICE-unix/8283"
declare -x XDG_SESSION_CLASS="user"
declare -x XDG_SESSION_DESKTOP="ubuntu"
declare -x XDG_SESSION_TYPE="x11"

2 Answers2

1

I have used qt4-based version of LDOCE5 viewer for a long time. I originally asked this question How to install LDOCE5 Viewer on Ubuntu) and N0rbert helped me to install it on Ubuntu 18.04. I just installed Ubuntu 20.04 and since the qt4-based libraries are obsolete I tried to install the qt5-based version. I followed the instructions for installing the qt5-based version (answered by n0rbert in the original question), but I came across some new issues with Ubuntu 20.04. I spent some time to resolve those issues and could install the software successfully. Unfortunately I could not find a way to fix the issue reported in the original question regarding the sound not playing. This requires further knowlege of Python/Qt and I hope someone else will help to resolve the issue.

Instructions for installing LDOCE5 viewer on Ubuntu 20.04:

  1. Install some dependencies:

    sudo apt-get install git make python pyqt5-dev-tools python3-pyqt5 \
    python3-pyqt5.qtwebkit python3-lxml python3-whoosh  qtgstreamer-plugins-qt5
    
  2. Install further dependencies for python3.8 on Ubuntu 20.04:

    sudo apt-get install python3-pip python3-setuptools python3-distutils
    
  3. Download ldoce5viewer-pyqt5 into ~/Downloads:

    cd ~/Downloads && git clone https://github.com/purboo/ldoce5viewer-pyqt5.git
    
  4. Open the Makefile in the download folder and change python to python3 on line 2:

    gedit ~/Downloads/ldoce5viewer-pyqt5/Makefile
    
  5. There is an obsolete library in the ldoce5viewer-pyqt5 called cgi.escape() which has been removed from python3.8. this library is used in three files. in order to fix the issue, we need to change cgi to html where we see from cgi import escape in the following three files:

    gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/ldoce5/transform.py 
    gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/qtgui/indexer.py 
    gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/ldoce5/extract.py 
    
  6. This step is based on an answer in the original question which suggested a fix for the sound issue. it did not work for me, but it may work for you. Open the following file and change

    'appsrc.emit('push-buffer', Gst.Buffer.new_wrapped(self._data[:size]))'
    

    to

    'appsrc.emit('push-buffer', Gst.Buffer.new_wrapped(self._data[:size].data()))'
    

    on line 114:

    gedit ~/Downloads/ldoce5viewer-pyqt5/ldoce5viewer/qtgui/utils/soundplayer.py
    
  7. Final step:

    make && sudo make install
    

Now you can find the software in the installed applications (press Super key and search for ldoce5).

Kulfy
  • 17,416
  • 26
  • 64
  • 103
rasul
  • 395
  • 1
  • 2
  • 14
  • 1
    Without touching `soundplayer.py` file, the pronunciation feature is working for me correctly. Thanks for your step-by-step guide! – Emadpres Apr 09 '21 at 16:17
0

The Qt4 library is obsolete, so it was removed from Ubuntu 20.04 LTS. Its manual installation is very difficult and long process.

So I would recommend to use schroot in this case.
We will install Ubuntu 18.04 LTS into it and follow my previous method.

We need to create and configure schroot first:

sudo apt-get install schroot debootstrap -y

cat <<EOF | sudo tee /etc/schroot/chroot.d/bionic.conf
[bionic]
description=Ubuntu 18.04 bionic
directory=/srv/chroot/bionic
root-users=$USER
type=directory
users=$USER
EOF

sudo mkdir -p /srv/chroot/bionic
sudo debootstrap bionic /srv/chroot/bionic

cat <<EOF | sudo tee /srv/chroot/bionic/etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu bionic main universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
EOF

schroot -c bionic -u root apt-get update
schroot -c bionic -u root apt-get install git make pyqt4-dev-tools python-lxml \
python-whoosh libqt4-opengl python-gst-1.0 wget sudo \
libcanberra-gtk3-module libcanberra-gtk-module desktop-file-utils

cd ~/Downloads
wget http://archive.ubuntu.com/ubuntu/pool/universe/p/python-qt4/pyqt4-dev-tools_4.11.4+dfsg-1build4_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/p/python-qt4/python-qt4_4.11.4+dfsg-1build4_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/s/sip4/python-sip_4.17+dfsg-1build1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/q/qtwebkit-source/libqtwebkit4_2.3.2-0ubuntu11_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1.1_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/universe/p/python-qt4/python-qt4-phonon_4.11.4+dfsg-1build4_amd64.deb

schroot -c bionic -u root apt-get install ./*.deb

Then download source code of Ldoce:

schroot -c bionic -u root git clone https://github.com/ciscorn/ldoce5viewer.git /usr/local/ldoce5viewer
schroot -c bionic -u root -d /usr/local/ldoce5viewer/ make
schroot -c bionic -u root -d /usr/local/ldoce5viewer/ make install

To run LDOCE 5 Viewer use

schroot -c bionic -u $USER env DISPLAY=$DISPLAY ldoce5viewer

Optionally you can create desktop application shortcut with this command inside.

N0rbert
  • 97,162
  • 34
  • 239
  • 423
  • Thanks for your answer. Before following these steps I just want to be sure these steps will not downgrade my Ubuntu 20.04 to 18.04, right? and also can we follow these steps in the future versions of Ubuntu? – ذوالفقار عبد الحليم May 10 '20 at 08:56
  • No, it will not. We create semi-virtual Ubuntu 18.04 inside real Ubuntu 20.04. Theoretically it will work in newer versions of Ubuntu. But with release 20.04 cycle it will happen in 5 years. So it is difficult to guess. – N0rbert May 10 '20 at 08:57
  • Does this mean we will need extra storage space for installing Ubuntu 18.04 inside Ubuntu 20.04? (something like 8GB or so?) – ذوالفقار عبد الحليم May 10 '20 at 09:04
  • Just checked the size - it needs 1.1 Gb of space. I do not have LDOCE5 distribution with me, so I can't check dictionary indexing and sound. – N0rbert May 10 '20 at 09:19
  • Thanks for you reply. I will follow these steps and report back on how it went. Because I have a slow internet connection it will take a lot of time. thanks again. – ذوالفقار عبد الحليم May 10 '20 at 09:28
  • sorry I was busy to reply back, but anyway I followed all the steps and when I run last step it says: No protocol specified ldoce5viewer: cannot connect to X server :0.0 – ذوالفقار عبد الحليم May 13 '20 at 07:34
  • This may be caused by Wayland session. Please logout from session and select Ubuntu or GNOME on Xorg on the login screen and retry. – N0rbert May 13 '20 at 07:37
  • I logged out and logged in, but the same problem and then rebooted my PC and again the same problem. and on login screen I don't see any options to select Ubuntu or GNOME. So the same problem: No protocol specified ldoce5viewer: cannot connect to X server :0.0 – ذوالفقار عبد الحليم May 13 '20 at 07:47
  • I have just ran the all above steps on default Ubuntu 20.04 LTS with GNOME on Wayland and it works as expected. Check the steps again. And also please add output of `export | grep SESSION` to your question by [editing](https://askubuntu.com/posts/1237337/edit) it. – N0rbert May 13 '20 at 07:53
  • I re-did all the steps but I keep getting the same problem. I edited my question and posted the output of _export | grep SESSION_ – ذوالفقار عبد الحليم May 13 '20 at 08:26
  • You may try to run it with `schroot -c bionic -u $USER env DISPLAY=$DISPLAY ldoce5viewer` – N0rbert May 13 '20 at 10:41
  • Let us [continue this discussion in chat](https://chat.stackexchange.com/rooms/107946/discussion-between----and-n0rbert). – ذوالفقار عبد الحليم May 13 '20 at 10:57
  • Well, tank you N0rbert for your patience. But in the end, I think we should move on. I guess these steps will works on some PCs and will not on other PCs. I HATE wine, but comparing to installing Ubuntu 18.04 inside Ubuntu 20.04 which took more than 1GB storage space, I think installing wine will be easier and with no headache and will require less storage space. But anyway I went ahead and installed wine and everything worked fine. Again thank you N0rbert. – ذوالفقار عبد الحليم May 17 '20 at 05:28