9

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?

8

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.

6

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

4
  • In the question: “this can be fixed by installing both pkg-config and libfontconfig1-dev to get the libraries, but I still got the error.”
    – Jeff Schaller
    Dec 14 '17 at 2:09
  • What is the error that you are getting ? Dec 15 '17 at 6:21
  • On Centos 7 I needed to yum -y install fontconfig-devel to get the missing dependency. Thank you! Jan 8 '18 at 17:18
  • Yeah, apt-file claimed I had it. A look at the directory showed it wasn't there. I ran "sudo apt-get install libfontconfig-dev" and then it was there. Dec 10 '20 at 15:59
0

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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.