[poppler] Static build

Jeroen Ooms jeroen at berkeley.edu
Wed Dec 5 16:53:53 UTC 2018


On Wed, Dec 5, 2018 at 5:12 PM Ranjan Ghosh <ghosh at pw6.de> wrote:
>
> Hmm. I think it doesnt work that easily. Actually, I'm trying to build a
> static pdf2svg which users poppler in turn. I tried to follow your
> advice and installed libcairo-dev, libopenjp2-7-dev, libjpeg-dev, etc.
> and then simply compiled poppler with -DBUILD_SHARED_LIBS=OFF. When I
> subsequently tried to compile pdf2svg as static with the static poppler
> I get:
>
> /usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoFontEngine.cc.o):
> undefined reference to symbol 'FT_Library_Version'
> /usr/bin/ld: //usr/lib/x86_64-linux-gnu/libfreetype.so.6: error adding
> symbols: DSO missing from command line
>
> I think the reason is that I actually must compile every single
> contributing library that is used by poppler as fully static beforehand
> instead of just installing them with apt, right?

Your linking error occurs because you're missing -lfreetype. When
static linking you need to include the linker flags for all the
dependencies. Unfortunately poppler does not correctly record it's
private dependencies in the pkg-config file, but try linking with
these flags:

   pkg-config --libs --static poppler-cpp cairo lcms2 libopenjp2 libtiff-4


More information about the poppler mailing list