I took me some time to build and run Anki from Source so I just wanted to give a guide how it worked eventually. I used a clean installation of Xubuntu 20.04 within VirtualBox 6.1 and Anki 2.1.47.
- Install Xubuntu (xubuntu-20.04.3-desktop-amd64.iso) into a new VM. I allowed the installation of third-party software (probably does not matter).
- Install VirtualBox Guest Additions and the automatic Xubuntu updates.
- Install these packages and bazel according to linux.md
sudo apt install bash grep findutils curl gcc g++ git
curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 -o ./bazel
chmod +x bazel && sudo mv bazel /usr/local/bin/
- Download Anki (2.1.47 in this case)
I used ankidev as folder name. According to development.md donât use ~/Anki or ~/Documents/Anki.
git clone https://github.com/ankitects/anki.git --single-branch -b 2.1.47 ankidev
cd ankidev
git checkout -b 2.1.47
- To solve this build error
ERROR: An error occurred during the fetch of repository âpy_depsâ: [âŠ]
ImportError: cannot import name âsysconfigâ from âdistutilsâ (/usr/lib/python3.8/distutils/init.py)
I had to install this package:
sudo apt install python3.8-distutils
- To solve this build error
/usr/bin/env: âpythonâ: No such file or directory
Target //qt:runanki failed to build
I had to install this package
sudo apt install python-is-python3
This sets python3 as your standard python. It seems to be a common topic for Ubuntu 20.04. You will find more info about it with Google.
- Start the build
./run
In my case it took ~70 mins and downloaded ~660 MB.
- At the first start of Anki I got a few errors of the type
Qt info: Could not load the Qt platform plugin âxcbâ in ââ even though it was found.
Qt fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
See below for details on how to solve them. I had to install these additional packages:
sudo apt install
libxcb-icccm4
libxcb-image0
libxcb-keysyms1
libxcb-render-util0
libxcb-xinerama0
libxcb-xkb1
After that Anki started. I just got a warning that the Anki database file is corrupt and will be recreated.
Details:
Error: Qt info: Could not load the Qt platform plugin âxcbâ in ââ even though it was found.
Qt fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Run export QT_DEBUG_PLUGINS=1
for more details according to this and you will get this type of message:
Qt warning: QLibraryPrivate::loadPlugin failed on "/home/khs/.cache/bazel/_bazel_khs/2ebc355c94ffa15c275887aebe564b30/external/pyqt5/PyQt5/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /home/khs/.cache/bazel/_bazel_khs/2ebc355c94ffa15c275887aebe564b30/external/pyqt5/PyQt5/Qt/plugins/platforms/libqxcb.so: (libxcb-icccm.so.4: Kann die Shared-Object-Datei nicht öffnen: Datei oder Verzeichnis nicht gefunden)"
It says (in German) that libqxcb.so cannot find libxcb-icccm.so. Use sudo apt search libxcb-icccm
to find the corresponding package name - in this case libxcb-icccm4. Install it with sudo apt install libxcb-icccm4
and repeat for all missing libraries. You can also run ldd on libxcb.so to see all missing libraries at once:
ldd /home/khs/.cache/bazel/_bazel_khs/2ebc355c94ffa15c275887aebe564b30/external/pyqt5/PyQt5/Qt/plugins/platforms/libqxcb.so