Windows binaries

Bug #499592 reported by Bernhard Reiter
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Poppler Python Bindings
Confirmed
Medium
Unassigned

Bug Description

There seems to be increased interest in Windows binaries, so it would be
great if they were officially maintained and released by the project, in
a similar fashion as PyGtk etc. windows versions are. For python-only
projects, it's rather tedious to set up a C toolchain just to getthe
poppler-python dependency fulfilled. As for the underlying poppler
dependency, maybe the poppler-dev* binaries from
ftp://ftp.gnome.org/Public/GNOME/binaries/win32/dependencies/ can be
used?

(Personally, I'm working on a Windows port of Gourmet Recipe Manager --
http://grecipe-manager.sourceforge.net -- which is a python only project
that requires poppler-python. Other apparently interested parties:
https://answers.launchpad.net/poppler-python/+question/36511 or comments
at http://code.google.com/p/gpapers/wiki/Windows)

Update 2009-12-27:
I'll (ab)use this bug report for documenting my progress... If anyone feels like giving this a shot, feel free to add your helpful hints!

Windows build procedure for poppler-python:
1. Install prerequisites:
1a. Python (from python.org -- I'm using version 2.6)
1b. Gtk+ (use an up-to-date 2.16 (not 2.20, it's said to be buggy!) series development bundle as found in http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.16/). Install e.g. To C:\GTK
1c. PyGtk (from pygtk.org, make sure to also install PyGObject and PyCairo from that website)
1d. poppler (poppler-dev_0.12.0-1_win32.zip from http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/ -- unzip to C:\Program Files\poppler\)

2. Get poppler-python ("pypoppler") sources from https://launchpad.net/poppler-python and untar them eg to your User directory (under Vista: C:\Users\YourUserName\)

3. Setup msys.
3a. As their installer is lagging behind version-wise, get the "premade" bundle from http://www.cccp-project.net/wiki/index.php?title=Installing_MSYS-MinGW#Updates and unzip to C:\ This gives you quite a feature complete development environment easily!
3b. It might be a good idea to link your User directory to msys's home. This is done by appending a line to C:\msys\1.0\etc\fstab, eg under Vista:
C:/Users/YourUserName/ /home/yourusername
(that's two tabstops in between)

4. Fix some flaws.
4a. To the top of pypoppler's configure.ac, add:
m4_pattern_allow([^dnl])
AC_CONFIG_MACRO_DIR([m4])
4b. To Makefile.am (after the line saying AUTOMAKE_OPTIONS=1.7), add
ACLOCAL_AMFLAGS=-I m4
4c. Paste pkg.m4 into pypoppler's ./m4/ directory (use eg the one from C:\GTK\share\aclocal)

5. Configure paths
5a. Add your Gtk+ installation's /bin subdirectory to your PATH environment variable (eg from the Control Panel -> System -> Advanced System Settings -> Advanced -> Environment Variables)
5b. You need to tell pkg-config where to find the dependencies (via the corresponding .pc files), so open C:\msys\1.0\etc\profile and append:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/mingw/lib/pkgconfig:/c/Program Files/Python26/Lib/pkgconfig:/c/GTK/lib/pkgconfig:/c/Program Files/poppler/lib/pkgconfig
export PATH=$PATH:/c/Program Files/Python26:/c/Program Files/Python26/bin
export CPPFLAGS="-I/c/Program Files/Python26/include"
export LDFLAGS+=" -L/c/Programme/Python26/libs -L/c/Programme/Python26/Lib -lpython26 -no-undefined"
(if you installed python and gtk to a different location than C:\Program Files\Python26 and C:\GTK\, respectively, you'll need to adapt this line accordingly -- you get the idea how to encode paths for msys, right?)
5c. Follow comment #39 here: https://bugzilla.gnome.org/show_bug.cgi?id=589671#c39

6. Configure and make
6a. Start C:\msys\1.0\msys.bat.
6b. cd to the pypoppler sources. If you followed steps 2 and 3b, that is just
cd ~/pypoppler-0.12.1
6c. autoreconf -i -f
6d. ./configure
6e. make
...and that's where I'm currently stuck.
(6f. would be: make install)

Revision history for this message
Ali Afshar (aafshar) wrote :

Great idea, any volunteers to maintain the Windows build? Bernhard, are you volunteering?

Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

Well I'm currently trying to get it up and running, but it's been a long time since I last tried to work with MinGW and msys. But maybe with a little help...

Revision history for this message
Ali Afshar (aafshar) wrote :

One approach might be to try to join in with the gnome-python-extras team of bindings. Sorry I can't help personally, as I have no Windows isntallations.

Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

I think it might be possible to cross-compile from linux (also using mingw)-- which might maybe faciliate maintenance, as more people could work on it.

description: updated
Revision history for this message
Steven Sproat (sproaty) wrote :

Hi,

I'm also interested in somehow getting this to work for Windows. I'm close - I've managed to get as far as compiling, finding GTK, and ATK, but am stuck on "finding" poppler.

After running export PKG_CONFIG_PATH="/mingw/lib/pkgconfig:/c//Python26/Lib/pkgconfig/:/c/GTK2-Runtime/lib/pkgconfig"

I haven't actually *installed* Poppler in any way, but have the following DLLs that I downloaded from the KDE Windows page:

libpoppler-glib-4.dll
libpoppler-5.dll
libgcc_s_dw2-1.dll

now, I'm wondering how to link PKG_CONFIG to these (or if it even supports DLLs)

checking for python... /usr/local/bin/python
checking for python version... 2.6
checking for python platform... win32
checking for python script directory... ${prefix}\Lib\site-packages
checking for python extension module directory... ${exec_prefix}\Lib\site-packaes
checking for headers required to compile python extensions... found
checking for pkg-config... /C/GTK2-R~1/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for PYPOPPLER... configure: error: Package requirements ( pygtk-2.0 >= 2.10.0,
                         atk >= 1.6.0,
                         poppler-glib >= 0.12
                         ) were not met:

No package 'poppler-glib' found

Any ideas, Bernhard? Have you made any progress ?

Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

This looks quite good... unfortunately, I haven't found much time lately.

One hint: instead of using singular dlls from the KDE build, try step 1d from my instructions above:

1d. poppler (poppler-dev_0.12.0-1_win32.zip from http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/ -- unzip to C:\Program Files\poppler\)

One reason to prefer this is that pkgconfig looks for *.pc files on PKG_CONFIG_PATH in order to determine dll paths, so the dlls alone won't suffice. (And don't forget to add /c/PROGRA~1/poppler/lib/pkgconfig to your PKG_CONFIG_PATH afterwards!)

Good luck -- I'd be glad if you could post back with your progress!

Revision history for this message
Steven Sproat (sproaty) wrote :
Download full text (3.7 KiB)

Hi again,

After downloading the poppler-dev binary, and linking it to my PKG_CONFIG_PATH, I've managed to get configure to run successfully!
I had to edit my cairo.pc file in python26/lib/pkgconfig, and remove the pixman-1 >= 0.10.0 dependency

However, I can't make much progress when executing make:

Steve@STEVEN /e/Downloads/pypoppler-0.12.1
$ make
make all-recursive
make[1]: Entering directory `/e/Downloads/pypoppler-0.12.1'
Making all in demo
make[2]: Entering directory `/e/Downloads/pypoppler-0.12.1/demo'
make[3]: Entering directory `/e/Downloads/pypoppler-0.12.1'
make[3]: Leaving directory `/e/Downloads/pypoppler-0.12.1'
make[3]: Entering directory `/e/Downloads/pypoppler-0.12.1'
make[3]: Leaving directory `/e/Downloads/pypoppler-0.12.1'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/e/Downloads/pypoppler-0.12.1/demo'
make[2]: Entering directory `/e/Downloads/pypoppler-0.12.1'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ic:\python26/include -Ic:/Python26/include/pygtk-2.0 -Ic:/GTK2-Runtime/include/glib-2.0 -Ic:/GTK2-Runtime/lib/glib-2.0/include -Ic:/GTK2-Runtime/include/atk-1.0 -Ic:/GTK2-Runtime/include/gtk-2.0 -Ic:/GTK2-Runtime/lib/gtk-2.0/include -Ic:/GTK2-Runtime/include/pango-1.0 -Ic:/GTK2-Runtime/include/cairo -Ic:/GTK2-Runtime/include/freetype2 -Ic:/GTK2-Runtime/include -Ie:/Downloads/poppler-dev/include/poppler/glib -Ic:/Python26/include/pycairo -Ic:/GTK2-Runtime/include/cairo -g -O2 -Wall -std=c9x -fno-strict-aliasing -MT poppler_la-popplermodule.lo -MD -MP -MF .deps/poppler_la-popplermodule.Tpo -c -o poppler_la-popplermodule.lo `test -f 'popplermodule.c' || echo './'`popplermodule.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -Ic:python26/include -Ic:/Python26/include/pygtk-2.0 -Ic:/GTK2-Runtime/include/glib-2.0 -Ic:/GTK2-Runtime/lib/glib-2.0/include -Ic:/GTK2-Runtime/include/atk-1.0 -Ic:/GTK2-Runtime/include/gtk-2.0 -Ic:/GTK2-Runtime/lib/gtk-2.0/include -Ic:/GTK2-Runtime/include/pango-1.0 -Ic:/GTK2-Runtime/include/cairo -Ic:/GTK2-Runtime/include/freetype2 -Ic:/GTK2-Runtime/include -Ie:/Downloads/poppler-dev/include/poppler/glib -Ic:/Python26/include/pycairo -Ic:/GTK2-Runtime/include/cairo -g -O2 -Wall -std=c9x -fno-strict-aliasing -MT poppler_la-popplermodule.lo -MD -MP -MF .deps/poppler_la-popplermodule.Tpo -c popplermodule.c -DDLL_EXPORT -DPIC -o .libs/poppler_la-popplermodule.o
In file included from popplermodule.c:25:
c:/Python26/include/pygtk-2.0/pygobject.h:5:20: Python.h: No such file or directory
In file included from popplermodule.c:25:

----

I'm not sure why this is, because in the first few arguments we see: /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ic:\python26/include

...the path where Python.h resides.

I just noticed that Cairo/GTK kind of don't work in Python....

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python26\lib\site-packages\gtk-2.0\gtk\__init__.py", line 48, in <module>
    from gtk import _gtk
  File "C:...

Read more...

Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

As for the Python.h include problem, that's pretty much where I'm currently stuck too. But I got a hint from dbozic (who posted a question about this topic about a year ago), and he pointed me to the following:

"Considering the compilation problem, I think I had to edit the makefile
and to change at various places a "\" into a "/" (e.g. instead of
c:\Python25\includes\ /c/Python25/includes/ or C:/Python25/includes/).
I know that this is [s]trange, but you have to be aware that mingw uses
unix syntax whereas python uses windows style...."

I haven't had time to try this out yet, but maybe you want to give it a shot.

Revision history for this message
Steven Sproat (sproaty) wrote :

Hi,

Still no luck here. It may be because I had to edit my configure file:

{ $as_echo "$as_me:$LINENO: checking for headers required to compile python extensions" >&5
$as_echo_n "checking for headers required to compile python extensions... " >&6; }
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
if test "$py_prefix" != "$py_exec_prefix"; then
  PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
fi

I had to change the includes directory to:

 PYTHON_INCLUDES="-I${py_prefix}/include"
 PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include"

because they were searching the wrong places. No matter how much I play with the PYTHON_INCLUDES path in the config.status file, it just doesn't seem to work. Pointing to the right directory with C:\\python26/include gives me python.h not found, and pointing to /c/python26/include tells me about glib.h not being found

Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote :

I'm not really into Windows development, recently a similar problem in PyGTK has been solved, you might want to look at this bug https://bugzilla.gnome.org/show_bug.cgi?id=589671

Changed in poppler-python:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Steven Sproat (sproaty) wrote :
Download full text (5.0 KiB)

Thanks, Gian. I will look into it. I hope you don't mind our discussion/progress taking place here.

I've managed to get somewhat further, now.

I added in these exports in the first post to my msys profile, https://bugzilla.gnome.org/show_bug.cgi?id=589671
I downloaded the latest 3 pycairo, gobject and pygtk from here -- http://www.johnstowers.co.nz/blog/index.php/2010/01/22/misc-hacking/

I edited the makefile so that PYTHON_INCLUDE =
(blank)

then the errors about python.h not found stopped, and were referring to glib/poppler.h not found
I took a look at the include argument in config.status and noticed it was E:\Downloads\poppler-dev\include\poppler\glib
I then changed this to E:\Downloads\poppler-dev\include\poppler

Next up was some problem with PyGTK defs:

make[2]: Entering directory `/e/Downloads/pypoppler-0.12.1'
(cd .\
        && /usr/local/bin/python C:/Python26/Lib/site-packages/gtk-2.0/codegen/codegen.py \
                --override poppler.override \
                --register c:/Python26/share/pygtk/2.0/defs/gdk-types.defs \
                --register c:/Python26/share/pygtk/2.0/defs/pango-types.defs \
                --register c:/Python26/share/pygtk/2.0/defs/gtk-types.defs \
                --prefix py_poppler poppler.defs) > gen-poppler.c \
                && cp gen-poppler.c poppler.c \
                && rm -f gen-poppler.c
Traceback (most recent call last):
  File "C:/Python26/Lib/site-packages/gtk-2.0/codegen/codegen.py", line 1720, in <module>
    sys.exit(main(sys.argv))
  File "C:/Python26/Lib/site-packages/gtk-2.0/codegen/codegen.py", line 1678, in main
    p.startParsing()
  File "C:\Python26\Lib\site-packages\gtk-2.0\codegen\scmexpr.py", line 114, in startParsing
    self.handle(statement)
  File "C:\Python26\Lib\site-packages\gtk-2.0\codegen\scmexpr.py", line 118, in handle
    getattr(self, cmd)(*tup[1:])
  File "C:\Python26\Lib\site-packages\gtk-2.0\codegen\defsparser.py", line 33, in include
    raise IOError("%s not found in include path %s" % (input_filename, inc_path))
IOError: gtk/gtk-2.16-types.defs not found in include path ['c:/Python26/share/pygtk/2.0/defs', '.']

As referenced here - https://bugzilla.gnome.org/show_bug.cgi?id=589671#c39
I edited the files in c:/Python26/share/pygtk/2.0/defs to make sure that no includes were prefixed with gtk/

I also had to edit my config.status to change these values:

S["pkgpyexecdir"]="${pyexecdir}/pypoppler"
S["pyexecdir"]="/C/Python26/Lib/site-packages"
S["pkgpythondir"]="${pythondir}/pypoppler"
S["pythondir"]="/C/Python26/Lib/site-packages" as they were set-up wrong

now I have managed to make/make install, but am pretty sure nothing is being done.

$ make
 /bin/sh ./config.status
config.status: creating Makefile
config.status: creating demo/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
make all-recursive
make[1]: Entering directory `/e/Downloads/pypoppler-0.12.1'
Making all in demo
make[2]: Entering directory `/e/Downloads/pypoppler-0.12.1/demo'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/e/Downloads/pypoppler-...

Read more...

Revision history for this message
Dario Santomarco (dario-santomarco) wrote :

Hi, I tried a little different way in making it compile but the result is the same:

"C:\Python26\Lib\site-packages has poppler.a (830kb) and poppler.la (1.6kb) files, but no .py/pyd."

I'm not so skilled, but, maybe something wrong in linking phase?

Regards
Dario

Revision history for this message
Wei-Ning Huang (aitjcize) wrote :

Anyone got this work yet?
I can now compile it to a static library (*.a)

when I trying to build a DLL, I got 'undefined reference error'
I add -lpoppler manually and still got the same error.

It seems that the poppler binary I downloaded from http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/
was not compiled correctly...

any ideas?

Revision history for this message
Jesús Cea (er-cea) wrote :

Hi, I found this link where there is a windows python poppler :

http://opensourcepack.blogspot.com/2010/03/pypoppler-pdf-rendering-in-pythonic-way.html

But, I had problems to test it, if someone can get test the pythonpoppler.pyd on windows, please, put the steps?

regards!!

Revision history for this message
Wei-Ning Huang (aitjcize) wrote :

Hi Jesús Cea Oliva:

I tried the link you provided and installed all dependencies,
but when I tried to import I get an ImportError

ImportError: DLL Load Failed

BTW, shouldn't there be a 'poppler.dll'?
I only find 'poppler.pyd' in the archive, perhaps that's why the import failed?

Revision history for this message
Jesús Cea (er-cea) wrote :

Yes AZ, I have the same problem, I don't know how resolve it. I'm very interested about win32 python poppler to develop a application for my project :S

PD: Sorry for my bad english.

Regards!

Revision history for this message
Waldemar Osuch (osuchw) wrote :

After a session with Dependency Walker I have managed to make it work by throwing the poppler.pyd from #14 and bunch of DDLs from win32 Evince distribution [http://live.gnome.org/Evince/Downloads] into the same directory.

Here is a self contained archive of the above.
http://sites.google.com/a/osuch.org/www/files/poppler.7z

The archive will be probably deleted later as I am not sure if I am allowed to distribute the DLLs in this form.

Revision history for this message
Jesús Cea (er-cea) wrote :

Thanks Waldemar!! It works for me without problems ^^, now to test with my application xD. Regards and thanks again!

Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

People, if you can get this thing to build, could you also try to help the maintainers of pypoppler to provide an official build? That'd be really appreciated. (I'm the OP, but don't have enough time currently...)

Revision history for this message
Jesús Cea (er-cea) wrote :

Is possible to get a compiled python poppler but with Python 2.4 instead of 2.6?, I need integrate a pdf viewer on an application build in Python 2.4 :S

Regards!

Revision history for this message
Wei-Ning Huang (aitjcize) wrote :

Ah ha! it worked!! thanks a lot Waldemar!
but I still like to know how to build it on windows...

Revision history for this message
cferriby@gmail.com (cferriby) wrote :

any progress/news on this? i would love to get pdf viewing in my python+gtk applications working on windows.

description: updated
description: updated
description: updated
description: updated
description: updated
Revision history for this message
Bernhard Reiter (ockham-razor) wrote :
Download full text (8.2 KiB)

I now also get the static *.a library -- see my updated description. Shared object creation fails with:
libtool: link: warning: undefined symbols not allowed in i686-pc-mingw32 shared libraries

Any ideas what's going wrong here? The full "make" result is:

$ make
make all-recursive
make[1]: Entering directory `/home/Bernie/workspace/poppler-python'
Making all in demo
make[2]: Entering directory `/home/Bernie/workspace/poppler-python/demo'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/Bernie/workspace/poppler-python/demo'
make[2]: Entering directory `/home/Bernie/workspace/poppler-python'
/bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -Ic:\PROGRA~1\Python26/include/python2.6 -I/c/Programme/Python26/include -mms-bitfields -Ic:/Programme/Python26/include/pygtk-2.0 -Ic:/GTK/include/glib-2.0 -Ic:/GTK/lib/glib-2.0/include -Ic:/GTK/include/atk-1.0 -Ic:/GTK/include/gtk-2.0 -Ic:/GTK/lib/gtk-2.0/include -Ic:/GTK/include/pango-1.0 -Ic:/GTK/include/cairo -Ic:/GTK/include/freetype2 -Ic:/GTK/include -Ic:/GTK/include/libpng14 -Ic:/Programme/poppler/include/poppler/glib -Ic:/Programme/poppler/include/poppler -Ic:/Programme/Python26/include/pycairo -Ic:/GTK/include/cairo -Ic:/GTK/include/freetype2 -Ic:/GTK/include -Ic:/GTK/include/libpng14 -I/c/Programme/Python26/include/pycairo -I/c/Programme/Python26/share/pygtk/2.0/defs -Wall -std=c9x -fno-strict-aliasing -MT poppler_la-popplermodule.lo -MD -MP -MF .deps/poppler_la-popplermodule.Tpo -c -o poppler_la-popplermodule.lo `test -f 'popplermodule.c' || echo './'`popplermodule.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. "-Ic:PROGRA~1Python26/include/python2.6" -I/c/Programme/Python26/include -mms-bitfields -Ic:/Programme/Python26/include/pygtk-2.0 -Ic:/GTK/include/glib-2.0 -Ic:/GTK/lib/glib-2.0/include -Ic:/GTK/include/atk-1.0 -Ic:/GTK/include/gtk-2.0 -Ic:/GTK/lib/gtk-2.0/include -Ic:/GTK/include/pango-1.0 -Ic:/GTK/include/cairo -Ic:/GTK/include/freetype2 -Ic:/GTK/include -Ic:/GTK/include/libpng14 -Ic:/Programme/poppler/include/poppler/glib -Ic:/Programme/poppler/include/poppler -Ic:/Programme/Python26/include/pycairo -Ic:/GTK/include/cairo -Ic:/GTK/include/freetype2 -Ic:/GTK/include -Ic:/GTK/include/libpng14 -I/c/Programme/Python26/include/pycairo -I/c/Programme/Python26/share/pygtk/2.0/defs -Wall -std=c9x -fno-strict-aliasing -MT poppler_la-popplermodule.lo -MD -MP -MF .deps/poppler_la-popplermodule.Tpo -c popplermodule.c -DDLL_EXPORT -DPIC -o .libs/poppler_la-popplermodule.o
mv -f .deps/poppler_la-popplermodule.Tpo .deps/poppler_la-popplermodule.Plo
(cd .\
        && /c/PROGRA~1/Python26//python c:/Programme/Python26/Lib/site-packages/gtk-2.0/codegen/codegen.py \
                --override poppler.override \
                --register c:/Programme/Python26/share/pygtk/2.0/defs/gdk-types.defs \
                --register c:/Programme/Python26/share/pygtk/2.0/defs/pango-types.defs \
                --register c:/Programme/Python26/share/pygtk/2.0/defs/gtk-types.defs \
                --prefix py_poppler poppler.defs) > gen-poppler.c \
                && cp gen-poppler.c poppler.c \
                && rm -f gen-poppler.c
Could not write method P...

Read more...

Revision history for this message
tumagonx (tumagonx) wrote :

Hi, I'm MyPaint's windows build maintainer (not related to poppler anyway :)) opensourcepack.blogspot.com

Bernhard: You need to add linker flag "-no-undefined" in LDFLAGS, aka export LDFLAGS+=" -no-undefined" just before configure. Just like that (in my case)
Jesús Cea: python poppler need more recent pycairo which need at least python 2.6

Is there a matching version thing (to poppler) in pypoppler? Poppler itself tend to change API quickly with different dll filename revision. So python poppler should be released as a bundled package, otherwise it may not works with different major version of poppler.

greets

Revision history for this message
Bernhard Reiter (ockham-razor) wrote :
Download full text (39.8 KiB)

Thanks tumagonx! Unfortunately, now the linker just complains about undefined python references:

.libs/poppler_la-popplermodule.o: In function `initpoppler':
C:\Users\Bernie\workspace\pypoppler-0.12.1/popplermodule.c:42: undefined reference to `_imp__PyCObject_Import'
.libs/poppler_la-popplermodule.o: In function `pygobject_init':
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:308: undefined reference to `_imp__PyImport_ImportModule'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:330: undefined reference to `_imp__PyObject_GetAttrString'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:331: undefined reference to `_imp__PyCObject_Type'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:334: undefined reference to `_imp__PyExc_ImportError'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:334: undefined reference to `_imp__PyErr_SetString'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:332: undefined reference to `_imp__PyCObject_AsVoidPtr'
.libs/poppler_la-popplermodule.o: In function `initpoppler':
C:\Users\Bernie\workspace\pypoppler-0.12.1/popplermodule.c:46: undefined reference to `_imp__Py_InitModule4'
C:\Users\Bernie\workspace\pypoppler-0.12.1/popplermodule.c:47: undefined reference to `_imp__PyModule_GetDict'
C:\Users\Bernie\workspace\pypoppler-0.12.1/popplermodule.c:53: undefined reference to `_imp__Py_BuildValue'
C:\Users\Bernie\workspace\pypoppler-0.12.1/popplermodule.c:53: undefined reference to `_imp__PyModule_AddObject'
C:\Users\Bernie\workspace\pypoppler-0.12.1/popplermodule.c:59: undefined reference to `_imp__PyErr_Occurred'
C:\Users\Bernie\workspace\pypoppler-0.12.1/popplermodule.c:60: undefined reference to `_imp__Py_FatalError'
.libs/poppler_la-popplermodule.o: In function `pygobject_init':
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:310: undefined reference to `_imp__PyErr_Occurred'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:314: undefined reference to `_imp__PyErr_Fetch'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:315: undefined reference to `_imp__PyObject_Repr'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:319: undefined reference to `_imp__PyString_AsString'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:319: undefined reference to `_imp__PyExc_ImportError'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:319: undefined reference to `_imp__PyErr_Format'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:324: undefined reference to `_imp__PyExc_ImportError'
c:/Programme/Python26/include/pygtk-2.0/pygobject.h:324: undefined reference to `_imp__PyErr_SetString'
.libs/poppler_la-poppler.o: In function `wrap_poppler_font_info_scan':
C:\Users\Bernie\workspace\pypoppler-0.12.1/poppler.override:330: undefined reference to `_imp__PyArg_ParseTupleAndKeywords'
.libs/poppler_la-poppler.o: In function `wrap_poppler_dest__get_named_dest':
C:\Users\Bernie\workspace\pypoppler-0.12.1/poppler.c:1756: undefined reference to `_imp__PyString_FromString'
C:\Users\Bernie\workspace\pypoppler-0.12.1/poppler.c:1757: undefined reference to `_imp___Py_NoneStruct'
.libs/poppler_la-poppler.o: In function `wrap_poppler_action_movie__get_title':
C:\Users\Bernie\workspace\pypoppler-0.12.1/pop...

description: updated
Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

Maintainers, would you mind performing step 4. from my build instructions to the current source code trunk?

4. Fix some flaws.
4a. To the top of pypoppler's configure.ac, add:
m4_pattern_allow([^dnl])
AC_CONFIG_MACRO_DIR([m4])
4b. To Makefile.am (after the line saying AUTOMAKE_OPTIONS=1.7), add
ACLOCAL_AMFLAGS=-I m4
4c. Paste pkg.m4 into pypoppler's ./m4/ directory (use eg the one from C:\GTK\share\aclocal)

description: updated
Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

The Python dependencies work now -- see updated LDFLAGS, but I'm still having trouble with the undefined poppler references, even after adding -L/c/Programme/poppler/lib -lpoppler.dll -lpoppler-glib.dll to LDFLAGS:

Creating library file: .libs/poppler.dll.a.libs/poppler_la-poppler.o: In function `wrap_poppler_page_get_image':
C:\Users\Bernie\workspace\pypoppler-0.12.1/poppler.override:595: undefined reference to `poppler_page_get_image'
.libs/poppler_la-poppler.o: In function `wrap_poppler_page_render_selection':
C:\Users\Bernie\workspace\pypoppler-0.12.1/poppler.c:3472: undefined reference to `poppler_page_render_selection'
.libs/poppler_la-poppler.o: In function `wrap_poppler_page_get_thumbnail':
C:\Users\Bernie\workspace\pypoppler-0.12.1/poppler.override:570: undefined reference to `poppler_page_get_thumbnail'
.libs/poppler_la-poppler.o: In function `wrap_poppler_page_render_for_printing':
C:\Users\Bernie\workspace\pypoppler-0.12.1/poppler.c:3408: undefined reference to `poppler_page_render_for_printing'
.libs/poppler_la-poppler.o: In function `wrap_poppler_page_render':
C:\Users\Bernie\workspace\pypoppler-0.12.1/poppler.c:3393: undefined reference to `poppler_page_render

Revision history for this message
tumagonx (tumagonx) wrote :

I've compile poppler runtime myself to build pypoppler binding since I can't find any at that time. I'm not entirely sure, but if you can grep poppler-glib.dll.a for that missing functions then it should be ok. I didn't add anything else to build pypoppler other than -no-undefined.

Anyway is it "-lpoppler-glib" was enough?

Revision history for this message
Sandro Mani (sandromani) wrote :

To share my experiences:
I successfully compiled pypoppler based on custom build poppler 0.15.3, using mingw.
Additional to a stock mingw development install and python2.7, find attache some usefull scripts I used, among others:
- notes.txt: all the hacks I needed to apply
- mktree.sh: script for automatically generating a GTK development tree based
- .profile: profile to use for the mingw shell

Hope this helps.

P.s.: in case anyone is interested in the binaries I compiled, I can make them available somewhere.

Revision history for this message
cferriby@gmail.com (cferriby) wrote :

I would be interested in these binaries. If you could put them up somewhere, email them to me, or something I would appreciate it.

Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote : Re: [Bug 499592] Re: Windows binaries

On Sat, Jan 1, 2011 at 4:37 PM, Sandro Mani <email address hidden>wrote:

Sandro,

> P.s.: in case anyone is interested in the binaries I compiled, I can
> make them available somewhere.
>

if you wish we could host your binaries right here in the download section.

cheers
--
Gian Mario Tagliaretti
GNOME Foundation member
<email address hidden>

Revision history for this message
Sandro Mani (sandromani) wrote :

The module is here http://n.ethz.ch/~smani/download/poppler/site-packages/poppler.pyd and all the needed dependencies can be found here in the GTK tree here: http://sourceforge.net/projects/gimagereader/files/gimagereader-win32-support/gimagereader-win32-support-0.5.zip/download

The module is compiled against python 2.7 and poppler 0.15.3 (and I think should work for the whole 0.15 and 0.16 branch, though not for the 0.14 branch since the API changed between 0.14 and 0.15 and I had to rename a function in pypoppler when compiling). Also, I ended with the module depending on some "external" dependencies (libgcc_s_dw2-1.dll and libstdc++-6.dll) additionally to the normal glib/gtk/gdk/cairo/poppler dlls, and I'm not sure what the cleanest way to distribute the module as "standalone" on windows would be...

Revision history for this message
cferriby@gmail.com (cferriby) wrote :

Thanks again Sandro the lib works great I have been using it against the pygtk all-in-one installer as well and than using the poppler libs from your package. I have come across a bug though. I have been using ThinkPython.pdf as my testing pdf until I was done developing the other parts of my application but when i test it with a pdf that has javascript and comments embedded it fails completely. I have also emailed the poppler mailing list to see about this bug. maybe it is because I am not using your gtk tree? I even tried to load the pdf in the demo python app but it fails as well. I am currently setting up the build system to rebuild the pypoppler to my libraries. I will let you guys know how if goes. I will host them as well if successful.

this is the error i get when trying to load it up. (visual studio 2010 debugger)

Unhandled exception at 0x7c9501cc in python.exe: 0xC0000029: An invalid unwind target was encountered during an unwind operation.

press continue

Unhandled exception at 0x7c9501cc in python.exe: 0xC0000029: An invalid unwind target was encountered during an unwind operation.

press continue

Unhandled exception at 0x77c35464 in python.exe: 0xC0000027: Unwind exception code.

press continue

Unhandled exception at 0x77c354c9 in python.exe: 0xC0000005: Access violation reading location 0x0003000a.

and then it stops there.

Revision history for this message
Sandro Mani (sandromani) wrote :

Uhm I actually am not related to poppler development in any way, so I don't know much more beyond making it compile. But as a suggestion, did you try the pdf on a linux build of pypoppler of the same version? Does it maybe work with a newer version? If you can narrow down the problem it's easier to find the specific cause.

Revision history for this message
Ysidro Denis (ymda06) wrote :

I have problem running the file (. /configure)

configure:3645: error: in `/home/Ysi/pypoppler-0.12.1':
configure:3647: error: C compiler cannot create executables
See `config.log' for more details

Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

Um, does anyone subscribed to this bug still have pypoppler binaries -- which also play nice when used in combination with the PyGTK all-in-one installer (http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/)? I'm not so much interested in the build chain anymore these days, I'd just like to have something that Just Works (tm).

Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote :

Bernhard if you are looking for something that works out of the box you should go with introspection bindings, it works on win32 and it's all packaged: http://sourceforge.net/projects/pygobjectwin32/files/

Revision history for this message
Bernhard Reiter (ockham-razor) wrote :

Gian Mario, thanks, I've noticed TumaGonx's work a while ago (OT: and contacted him to thank him and point out a bug in the rev13 installer which won't run on my Vista). I'm going to port Gourmet to PyGI in one of the next releases, but for the imminent 0.17.0 -- which is still PyGTK based -- I'm only missing a working printing function due to lack of pypoppler binaries.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.