Typically that happens because some development package has not been installed. I don't have much experience with Ubuntu, but I regularly have the same problem under Fedora. Under Fedora, I check which package has the libary that's called for and then see if there is a -devel version of that package. So far there has always been one, and installing it resolves the problem. I think it even happened when I compiled the argyll suite of programs. I think Ubuntu will work in much the same way. If you want to compile programs from source, you have to have many such -devel packages installed on your system.