Compiling a program from source

You can't compile very new software on not-so-very old system because of dependencies. Manual installation of new dependencies on old system will break it.

As not-harmful alternative you can use Okular 21.08.2 flatpak from KDE instead on your Ubuntu 18.04 LTS. Install it with:

sudo add-apt-repository ppa:flatpak/stable
sudo apt update
sudo apt install flatpak

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

flatpak install flathub org.kde.okular

And to start it use

flatpak run org.kde.okular

or find relevant icon in your desktop environment.