Some libraries are not found during the compilation or execution, while I have installed all of the prerequired libraries.

The libraries are sometimes not found because they have been placed in directories not scanned by the system during the compilation or the execution. A way to solve this is to properly set the environment variables. Assuming you are using the bash system, add the following lines to the file $HOME/.bashrc:
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Launch a new terminal and try again.

© Fabian Bastin.