Hm. I tried to follow your advice and after fighting through a multitude
of additional libraries that were missing, I now configure pdf2svg with
this script:
#!/bin/bash
export CFLAGS="-static -lm -pthread "`pkg-config --cflags --static
freetype2 poppler-cpp cairo lcms2 libtiff-4 libffi pixman-1 glib-2.0
libpcre`
export LDFLAGS="-static -lm -pthread "`pkg-config --libs --static
freetype2 poppler-cpp cairo lcms2 libtiff-4 libffi pixman-1 glib-2.0
libpcre`
./configure
===
But, unfortunately, when running "make" I get this (especially I dont
understand the missing sqrt because I specifically said lm; there are
more weird errors about missing I'm just posting the first lines here):
gcc -I/usr/include/cairo -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid
-I/usr/local/include/poppler/glib -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/cairo
-I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16
-I/usr/include/uuid -I/usr/local/include/poppler -static -lm -pthread
-I/usr/include/freetype2 -I/usr/include/libpng16
-I/usr/local/include/poppler/cpp -I/usr/local/include/poppler
-I/usr/include/cairo -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/uuid -I/usr/local/include
-I/usr/include/x86_64-linux-gnu -static -lm -pthread -lz -lm -lm -lz
-L/usr/local/lib -lpoppler-cpp -L/usr/local/lib -lpoppler -lcairo -lz
-lz -lz -lgobject-2.0 -pthread -lpcre -lpcre -pthread -lglib-2.0
-pthread -lpcre -lpcre -pthread -lpixman-1 -lfontconfig -lz -lm -lm -lz
-luuid -lexpat -lfreetype -lz -lm -lm -lz -lpng16 -lm -lm -lz -lxcb-shm
-lxcb -lxcb-render -lxcb -lXrender -lX11 -lpthread -lxcb -lpthread -lxcb
-lX11 -lpthread -lxcb -lXext -lX11 -lpthread -lxcb -lXau -lXdmcp -llcms2
-lm -lpthread -ltiff -llzma -ljbig -ljpeg -lz -lm -lffi -lpixman-1
-lglib-2.0 -pthread -lpcre -lpcre -pthread -o pdf2svg pdf2svg-pdf2svg.o
-lcairo -L/usr/local/lib -lpoppler-glib -lgobject-2.0 -lglib-2.0 -lcairo
/usr/bin/ld:
/usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/libglib-2.0.a(libglib_2_0_la-gutils.o):
in function `g_get_user_database_entry':
(.text+0x277): warning: Using 'getpwuid' in statically linked
applications requires at runtime the shared libraries from the glibc
version used for linking
/usr/bin/ld: (.text+0xe0): warning: Using 'getpwnam_r' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
/usr/bin/ld: (.text+0x11e): warning: Using 'getpwuid_r' in statically
linked applications requires at runtime the shared libraries from the
glibc version used for linking
/usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoOutputDev.cc.o): in
function `CairoOutputDev::~CairoOutputDev()':
CairoOutputDev.cc:(.text+0x1b9): undefined reference to `operator
delete(void*, unsigned long)'
/usr/bin/ld: CairoOutputDev.cc:(.text+0x226): undefined reference to
`TextPage::decRefCnt()'
/usr/bin/ld: CairoOutputDev.cc:(.text+0x23a): undefined reference to
`ActualText::~ActualText()'
/usr/bin/ld: CairoOutputDev.cc:(.text+0x247): undefined reference to
`operator delete(void*, unsigned long)'
/usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoOutputDev.cc.o): in
function `CairoOutputDev::startPage(int, GfxState*, XRef*)':
CairoOutputDev.cc:(.text+0x2fd): undefined reference to
`TextPage::startPage(GfxState*)'
/usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoOutputDev.cc.o): in
function `CairoOutputDev::endPage()':
CairoOutputDev.cc:(.text+0x334): undefined reference to
`TextPage::endPage()'
/usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoOutputDev.cc.o): in
function `CairoOutputDev::saveState(GfxState*)':
CairoOutputDev.cc:(.text+0x38c): undefined reference to `operator
new(unsigned long)'
/usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoOutputDev.cc.o): in
function `CairoOutputDev::restoreState(GfxState*)':
CairoOutputDev.cc:(.text+0x4fb): undefined reference to `operator
delete(void*, unsigned long)'
/usr/bin/ld: CairoOutputDev.cc:(.text+0x51d): undefined reference to
`GfxPath::~GfxPath()'
/usr/bin/ld: CairoOutputDev.cc:(.text+0x52a): undefined reference to
`operator delete(void*, unsigned long)'
/usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoOutputDev.cc.o): in
function `CairoImageOutputDev::~CairoImageOutputDev()':
CairoOutputDev.cc:(.text+0x5d0): undefined reference to `operator
delete(void*, unsigned long)'
/usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoOutputDev.cc.o): in
function `CairoOutputDev::updateFont(GfxState*)':
CairoOutputDev.cc:(.text+0xb13): undefined reference to
`TextPage::updateFont(GfxState*)'
/usr/bin/ld: CairoOutputDev.cc:(.text+0xca3): undefined reference to
`error(ErrorCategory, long long, char const*, ...)'
/usr/bin/ld: /usr/local/lib/libpoppler-glib.a(CairoOutputDev.cc.o): in
function `get_singular_values(_cairo_matrix const*, double*, double*)':
CairoOutputDev.cc:(.text+0xebd): undefined reference to `sqrt'
/usr/bin/ld: CairoOutputDev.cc:(.text+0xeed): undefined reference to `sqrt'
Am 05.12.18 um 17:53 schrieb Jeroen Ooms:
On Wed, Dec 5, 2018 at 5:12 PM Ranjan Ghosh <gh...@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
_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler