18

Whilst attempting to compile poppler from source I get the error Package "fontconfig" not found.

I have found a lot of other resources advertising that this can be fixed by installing both pkg-config and libfontconfig1-dev to get the libraries, but I still got the error.

Trying to install fontconfig from source failed at the make step and I've found no resources on how to fix (whole host of C errors).

If I have fontconfig on the system (and apt seems to suggest I do) how can I use it when running ./configure for a package?

M1ke
  • 539
  • 1
  • 4
  • 11

4 Answers4

18

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

Fakabbir Amin
  • 291
  • 2
  • 4
13

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.

M1ke
  • 539
  • 1
  • 4
  • 11
2

I'm under Ubuntu 16.04 LTS 64-bits. I got this error while compiling the NAEV game and I looked at the answers listed here.

I searched for fontconfig.pc, it was found and I set PKG_CONFIG_PATH to the proper path, to no avail.

libfontconfig1-dev was actually listed as installed.

After looking at other sites, I however re-ran sudo apt-get install libfontconfig-dev to be sure, it told me it would actually install libfontconfig1-dev, so I confirmed. Then I unset PKG_CONFIG_PATH to be sure to test in the original configuration, and ran ./configure : it worked.

So my answer for such errors is the following : even if your system says the missing package is installed and finds the pc file, reinstall it by the book, there might be a glitch somewhere reinstall can fix...

Mutos
  • 121
  • 3
1

Installing libfontconfig1-dev solved the issue for me.

sudo apt install libfontconfig1-dev
Aalkhodiry
  • 111
  • 2