Re: [poppler] Static build

2018-12-14 Thread Ranjan Ghosh
Wow. What a wild ride. Once you type "ldd pdf2svg" and you really see 
"Not a dynamic executable" after literally days of work you almost 
cannot believe it's true. Thank you so much, Jeroen! It took me a while 
to finally figure it all out, but I eventually managed to build a static 
pdf2svg binary. The single sentence below from you was very short and 
(for me) initially *extremely* cryptic (I'm no expert on all this stuff, 
mind you) but turned out to be one of the wisest tips I ever got in IT. 
So much cleverness crammed into one single sentence. I just had to trust 
exactly what you said and diligently follow through and solve every 
single compilation error and consequence that resulted out of it.


I posted on the relevant pdf2svg issue how I've finally managed to put 
everything together in case some else finds it useful:


https://github.com/dawbarton/pdf2svg/issues/5

Am 05.12.18 um 17:53 schrieb Jeroen Ooms:


When static linking you need to include the linker flags for all the
dependencies.

___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Static build

2018-12-05 Thread Ranjan Ghosh
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: 

Re: [poppler] Static build

2018-12-05 Thread Jeroen Ooms
On Wed, Dec 5, 2018 at 5:12 PM Ranjan Ghosh  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


Re: [poppler] Static build

2018-12-05 Thread Ranjan Ghosh
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?



Am 04.12.18 um 23:11 schrieb Jeroen Ooms:

On Tue, Dec 4, 2018 at 4:44 PM Ranjan Ghosh  wrote:

Hi all,

I'm desperately trying to create a fully static build without any
dependencies. I already got pretty far (IMHO) and build lots and lots of
other dependent libaries statically (cairo, freetype etc.) without
encountering any major problems.

Have a look at the homebrew formulae, I use those to statically build
packages on MacOS. Afaik it works by default in the latest releases,
just use cmake -DBUILD_SHARED_LIBS=OFF like here:
https://github.com/Homebrew/homebrew-core/blob/master/Formula/poppler.rb#L67

___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Static build

2018-12-04 Thread Jeroen Ooms
On Tue, Dec 4, 2018 at 4:44 PM Ranjan Ghosh  wrote:
>
> Hi all,
>
> I'm desperately trying to create a fully static build without any
> dependencies. I already got pretty far (IMHO) and build lots and lots of
> other dependent libaries statically (cairo, freetype etc.) without
> encountering any major problems.

Have a look at the homebrew formulae, I use those to statically build
packages on MacOS. Afaik it works by default in the latest releases,
just use cmake -DBUILD_SHARED_LIBS=OFF like here:
https://github.com/Homebrew/homebrew-core/blob/master/Formula/poppler.rb#L67
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Static build

2018-12-04 Thread Jason Crain
On 2018-12-04, Ranjan Ghosh  wrote:
> [ 71%] Linking CXX executable pdftocairo
> /usr/bin/ld: /usr/local/lib/libcairo.a(cairo-image-surface.o): in function
> `_cairo_image_surface_finish':
> /usr/src/cairo/src/cairo-image-surface.c:846: undefined reference to
> `pixman_image_unref'
> /usr/bin/ld: /usr/local/lib/libcairo.a(cairo-image-surface.o): in function
> `_cairo_image_surface_init':
> /usr/src/cairo/src/cairo-image-surface.c:164: undefined reference to
> `pixman_image_get_data'
> /usr/bin/ld: /usr/src/cairo/src/cairo-image-surface.c:169: undefined
> reference to `pixman_image_get_width'
> /usr/bin/ld: /usr/src/cairo/src/cairo-image-surface.c:170: undefined
> reference to `pixman_image_get_height'
> /usr/bin/ld: /usr/src/cairo/src/cairo-image-surface.c:171: undefined
> reference to `pixman_image_get_stride'
> /usr/bin/ld: /usr/src/cairo/src/cairo-image-surface.c:172: undefined
> reference to `pixman_image_get_depth'
> /usr/bin/ld: /usr/local/lib/libcairo.a(cairo-image-surface.o): in function
> `_pixman_format_from_masks':
> 
> Any help on how to overcome this problem would be much appreciated.

Did you link to pixman? It's a dependency of cairo.
___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


[poppler] Static build

2018-12-04 Thread Ranjan Ghosh

Hi all,

I'm desperately trying to create a fully static build without any 
dependencies. I already got pretty far (IMHO) and build lots and lots of 
other dependent libaries statically (cairo, freetype etc.) without 
encountering any major problems.


Now, with poppler, I got a first compilation error but could solve it as 
discussed here:


https://www.mail-archive.com/poppler@lists.freedesktop.org/msg10543.html

With this patch:

https://github.com/mpsuzuki/poppler/commit/3f944ed5dee3496e7a7c661eabc3b16448316d13

Which worked fabulously. This should definitely be included in the main 
poppler branch, I guess, as it looks like it doesnt hurt anyone who isnt 
compiling statically - but OTOH is hugely helpful for those like me who 
dare to try it.


After that, make continues up until 71%:

[ 71%] Linking CXX executable pdftocairo
/usr/bin/ld: /usr/local/lib/libcairo.a(cairo-image-surface.o): in 
function `_cairo_image_surface_finish':
/usr/src/cairo/src/cairo-image-surface.c:846: undefined reference to 
`pixman_image_unref'
/usr/bin/ld: /usr/local/lib/libcairo.a(cairo-image-surface.o): in 
function `_cairo_image_surface_init':
/usr/src/cairo/src/cairo-image-surface.c:164: undefined reference to 
`pixman_image_get_data'
/usr/bin/ld: /usr/src/cairo/src/cairo-image-surface.c:169: undefined 
reference to `pixman_image_get_width'
/usr/bin/ld: /usr/src/cairo/src/cairo-image-surface.c:170: undefined 
reference to `pixman_image_get_height'
/usr/bin/ld: /usr/src/cairo/src/cairo-image-surface.c:171: undefined 
reference to `pixman_image_get_stride'
/usr/bin/ld: /usr/src/cairo/src/cairo-image-surface.c:172: undefined 
reference to `pixman_image_get_depth'
/usr/bin/ld: /usr/local/lib/libcairo.a(cairo-image-surface.o): in 
function `_pixman_format_from_masks':


Any help on how to overcome this problem would be much appreciated.

Thank you / BR

Ranjan



___
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler


Re: [poppler] Static build of utils

2010-04-15 Thread Mike Tonks
Thanks Patrick, I guess I should try again to build with mingw to get
away from the cygwin issues.  Just that cygwin has most of the
dependencies if you hunt through the package list, and I didn't have
much luck with mingw on the first attempt.

Ideally I would like to deploy to various windows machines just by
dropping in an exe, without having to install a load of stuff.  I
guess if I have all the dll's this might not be a problem.

We have an old pdf2xml.exe for example that does just this, built
against the original xpdf libraries.

mike


On 15 April 2010 10:57, Patrick Spendrin ps...@gmx.de wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Am 13.04.2010 18:34, schrieb Mike Tonks:
 Hi,

 Is it easy to build the utils statically - I would really like a
 statically linked pdftohtml.exe (on Windows).

 I have sucessfully built poppler under cygwin using:

 ./configure
 make

 Is there some option I can add to this to create a static build?

 Thanks for any help.

 Well, the problem is to have all your dependencies as static libraries
 as well.
 For me this freetype, jpeg, openjpeg, lcms, libpng, for you also
 cygwin*, which you would all need as static libraries as well. This is
 probably much harder than getting poppler itself building statically
 (you already do not have any dependency on libpoppler at all for pdftohtml).
 You can see the dependencies of your .exe or your dll with depends.exe
 (Dependency Walker, search for it on google).
 - From my point of view, I would rethink why you need a static file.


 mike

 regards,
 Patrick

 * it might be even impossible to have a static cygwin.dll

 ___
 poppler mailing list
 poppler@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/poppler


 -BEGIN PGP SIGNATURE-
 Version: GnuPG v2.0.10 (MingW32)

 iEYEARECAAYFAkvG4xMACgkQi49rfdk/G3blRwCfb33BJKm6y7W/86GHT7J6Ksyi
 1BYAoJqVM/l+nR/WeYxLX0XPuXcYJsnU
 =YZ+P
 -END PGP SIGNATURE-
 ___
 poppler mailing list
 poppler@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/poppler

___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler


[poppler] Static build of utils

2010-04-13 Thread Mike Tonks
Hi,

Is it easy to build the utils statically - I would really like a
statically linked pdftohtml.exe (on Windows).

I have sucessfully built poppler under cygwin using:

./configure
make

Is there some option I can add to this to create a static build?

Thanks for any help.

mike
___
poppler mailing list
poppler@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/poppler