git clone https://github.com/ArtifexSoftware/mupdf
cd mupdf
make shared build=debug
# or:
make shared-debug
Then the result will be in build/shared-debug/
.
You can optionally do something like the following afterwards:
make shared-install-c build=debug
make shared-install-c++ build=debug
If you want, you can run it in zathura with the following command:
LD_LIBRARY_PATH=/......../mupdf/build/shared-debug/ gdb zathura -ex "run file.pdf"