Package "fontconfig" not found despite having installed libfontconfig1-dev

The key here turned out to be the PKG_CONFIG_PATH environment variable. This was empty on a standard shell session on my system.

There seem to be lots of directories with pkgconfig in the name, but to find the correct one I was able to use apt-file per this thread i.e.

$ apt-file search fontconfig.pc libfontconfig1-dev: /usr/lib/x86_64-linux-gnu/pkgconfig/fontconfig.pc

Then run

export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig

And now the ./configure step can find the .pc file which it requires for that library. Learning about apt-file seems to be a useful outcome of this problem.


Whenever you get messages about missing packages (or suggestions to modify your PKG_CONFIG_PATH) during a build, it usually indicates that you are missing the corresponding development package - which is typically separate from the runtime package that is normally installed on the system.

In this case you have the most recent version of fontconfig but are probably missing the corresponding libfontconfig1-dev package.

src: https://askubuntu.com/questions/536714/autogen-sh-cant-find-fontconfig-package