How to guess missing dependencies with apt get

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the unix category.

Last Updated: 2022-05-26

When trying to build the Project B PHP container, I got the following error:

configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

Generally speaking, what does one do in the face of .h errors when not working directly in C?

The .h means libpq-fe.h is a header file. So assume it is missing C library and probably called something like libpq). The first port of call is apt-get install libpq therefore. (It goes without saying that you should scale your due diligence about installing each package as justified by the environment/project.)

In case that does not work, but there is often a parallel X-dev version of libraries that is available. Here that would be libpq-dev and this was indeed installable with apt-get install libpq-dev.

Lesson:

When dependencies complain about missing header files (X.h), try apt-get install X or apt-get install x-dev.