This post explains how to compile zathura 0.5.11 in Ubuntu 24.04 LTS.
I performed these installation steps in a Ubuntu fresh installation in a laptop instead of my desktop computer to make sure that none of my configurations from my desktop computer interfered with the normal behavior of the compilation steps. I run the commands below upon installing Ubuntu. I installed OpenSSH to start a SSH server because I wanted to run the commands from my desktop computer through a SSH connection to my laptop.
sudo apt update sudo apt upgrade sudo apt install git openssh-server systemctl start ssh.service
Step no. 1: Compile girara
As of this writing, the latest tag available at https://github.com/pwmt/girara/tags is 0.4.5
. I used the command below to clone the source code of that tag.
git clone --branch 0.4.5 --depth 1 'https://github.com/pwmt/girara' /tmp/girara
I installed the dependencies using the command below. Some of these are explicitly mentioned in the README.md file at the girara repository (permalink).
sudo apt-get install meson pkg-config libglib2.0-dev libgtk-3-dev gettext
cd /tmp/girara meson build cd build ninja sudo ninja install
Step no. 2: Compile mupdf
As of this writing, the latest tag available at https://github.com/ArtifexSoftware/mupdf/tags is 1.25.4
. I used the command below to clone the source code of that tag.
git clone --branch 1.25.4 --depth 1 'https://github.com/ArtifexSoftware/mupdf' /tmp/mupdf
I needed to install the dependencies in the first code block below to compile mupdf
.
Installing the package libglu1-mesa-dev
solved fatal error: GL/gl.h: No such file or directory
which was shown by make install
.
Installing the package libxi-dev
solved fatal error: X11/extensions/XInput.h: No such file or directory
which was shown by make install
..
Installing the package libxrandr-dev
solved fatal error: X11/extensions/Xrandr.h: No such file or directory
which was shown by make install
..
sudo apt install libglu1-mesa-dev libxi-dev libxrandr-dev
I was able to compile mupdf
using the commands below.
cd /tmp/mupdf git submodule update --init --recursive --depth 1 sudo make XCFLAGS=-fPIC --jobs=8 install
Step no. 3: Compile zathura
As of this writing, the latest tag available at https://github.com/pwmt/zathura/tags was 0.5.11
. I used the command below to clone that specific tag.
git clone --branch 0.5.11 --depth 1 'https://github.com/pwmt/zathura' /tmp/zathura
sudo apt install libjson-glib-dev libmagic-dev libsqlite3-dev
Upon installing the dependencies, I run the commands mentioned in https://github.com/pwmt/zathura/blob/0.5.11/README.md
cd /tmp/zathura meson build cd build ninja sudo ninja install
Step no. 4: Compile zathura-pdf-mupdf
As of this writing, the latest tag available at https://github.com/pwmt/zathura-pdf-mupdf/tags was 0.4.4
. I used the command below to clone that specific tag.
git clone --branch 0.4.4 --depth 1 'https://github.com/pwmt/zathura-pdf-mupdf' /tmp/zathura-pdf-mupdf
cd /tmp/zathura-pdf-mupdf meson build cd build ninja sudo ninja install
Upon completion, the following file was created.
$ find /usr/local/lib/x86_64-linux-gnu/zathura /usr/local/lib/x86_64-linux-gnu/zathura /usr/local/lib/x86_64-linux-gnu/zathura/libpdf-mupdf.so
Launch zathura
I downloaded a sample PDF file from a trusted source on the Internet.
wget -O /tmp/output.pdf 'https://gcc.gnu.org/onlinedocs/cpp.pdf'
I used the command below to open the PDF file in Zathura
LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu /usr/local/bin/zathura /tmp/output.pdf
At this point, I could see the contents of the PDF file.
Additional notes
:CREATED:
I could neither open the PDF file (see first code block below) nor print the version (see second code block below) when I didn’t set the variable LD_LIBRARY_PATH
.
rodrigo@delta:/tmp/zathura-pdf-mupdf/build$ /usr/local/bin/zathura --version /usr/local/bin/zathura: error while loading shared libraries: libgirara-gtk3.so.4: cannot open shared object file: No such file or directory
rodrigo@delta:/tmp/zathura-pdf-mupdf/build$ /usr/local/bin/zathura /tmp/output.pdf /usr/local/bin/zathura: error while loading shared libraries: libgirara-gtk3.so.4: cannot open shared object file: No such file or directory
Although I could open PDF files in Zathura, there were some notifications that I noticed.
The first code block below shows the output when the /tmp/output.pdf
was opened with Zathura (Zathura did show the pages of the PDF).
$ LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu /usr/local/bin/zathura /tmp/output.pdf
info: Opening plain database via sqlite backend.
info: No plain database available. Continuing with sqlite database.
The following code block shows the behavior of zathura when setting the variables LD_LIBRARY_PATH
and ZATHURA_PLUGINS_PATH
. There were no errors when only setting LD_LIBRARY_PATH
(see third code block below.)
$ LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu ZATHURA_PLUGINS_PATH=/usr/local/lib/x86_64-linux-gnu /usr/local/bin/zathura --version error: Could not find 'zathura_plugin_6_7' in plugin /usr/local/lib/x86_64-linux-gnu/libgirara-gtk3.so - is not a plugin or needs to be rebuilt. zathura 0.5.11 girara 0.4.5 (runtime: 0.4.5) (plugin) pdf-mupdf (0.4.4) (/usr/local/lib/x86_64-linux-gnu/zathura/libpdf-mupdf.so)
$ LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu ZATHURA_PLUGINS_PATH=/usr/local/lib/x86_64-linux-gnu/zathura /usr/local/bin/zathura --version error: plugin: filetype already registered: application/pdf error: plugin: filetype already registered: application/oxps error: plugin: filetype already registered: application/epub+zip error: plugin: filetype already registered: application/x-fictionbook+xml error: plugin: filetype already registered: application/xml error: Could not register plugin '/usr/local/lib/x86_64-linux-gnu/zathura/libpdf-mupdf.so'. zathura 0.5.11 girara 0.4.5 (runtime: 0.4.5) (plugin) pdf-mupdf (0.4.4) (/usr/local/lib/x86_64-linux-gnu/zathura/libpdf-mupdf.so)
$ LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu /usr/local/bin/zathura --version zathura 0.5.11 girara 0.4.5 (runtime: 0.4.5) (plugin) pdf-mupdf (0.4.4) (/usr/local/lib/x86_64-linux-gnu/zathura/libpdf-mupdf.so)