Issue #1 open

Please fix/document building on Windows

klo
created an issue

Hi,

I downloaded source code from pypi. I noticed it's flagged also as Windows compatible, but I can't see how to install it, and I can't find any instructions.

python setup.py build isn't enough and I have MinGW, while I don't use Cygwin.

So how to?

TIA

Comments (9)

  1. Jakub Wilk repo owner

    Thanks for the bug report.

    I think that building on Windows doesn't currently work out of the box. (I don't have access to a Windows machine though, so I can't tell for sure.) Sorry about that.

    You said that python setup.py build isn't enough. Could you eleborate on that? Does building fail? Either way, you shouldn't need Cygwin. :-)

    In the mean time, you could use these pre-built Windows binaries: http://pypi.python.org/pypi/python-djvulibre/0.3.4 (It's an old version, unfortunately.)

  2. klo reporter

    Here is example, with current source (hg clone):

    C:\src\hg\python-djvulibre>python setup.py build
    Traceback (most recent call last):
      File "setup.py", line 235, in <module>
        for name in ext_modules
      File "setup.py", line 102, in pkg_config
        raise IOError('[pkg-config] ' + stderr.strip())
    IOError: [pkg-config] Package ddjvuapi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `ddjvuapi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'ddjvuapi' found
    

    I see mingw32cross.py file, and thought it would do some magic automatically, but nothing happens as can be seen from above example.

    If you would like me to run some instructions, please say. In the meantime I'll use 0.3.4

    Cheers

  3. klo reporter
    C:\src\hg\python-djvulibre>python setup.py build
    pkg-config failed: Package ddjvuapi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `ddjvuapi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'ddjvuapi' found
    pkg-config failed: Package ddjvuapi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `ddjvuapi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'ddjvuapi' found
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    creating build\lib.win32-2.7\djvu
    copying djvu\__init__.py -> build\lib.win32-2.7\djvu
    copying djvu\const.py -> build\lib.win32-2.7\djvu
    copying djvu\dllpath.py -> build\lib.win32-2.7\djvu
    running build_ext
    creating 'djvu/config.pxi'
    cythoning 'djvu.decode' extension
    generating djvu/decode.c from djvu/decode.pyx, djvu/config.pxi, djvu/common.pxi, djvu\decode.pxd, djvu\sexpr.pxd
    C:\Python27\Scripts\cython.exe djvu/decode.pyx
    building 'djvu.decode' extension
    creating build\temp.win32-2.7
    creating build\temp.win32-2.7\Release
    creating build\temp.win32-2.7\Release\djvu
    C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c djvu/decode.c -o build\temp.win32-2.7\Release\djvu\decode.o
    djvu/decode.c:255:29: fatal error: libdjvu/miniexp.h: No such file or directory
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
  4. klo reporter

    Hi Jakub,

    I use 64 bit Python now, and I guess I'll need to build 64 bit djvulibre to be able to build your source. Unfortunately, there are many dependencies prior building 64 bit djvulibre on Windows, and even if I try I don't believe I can make it, so I'll wait until djvulibre developers make 64 bit Windows distribution.

    Trying to build your source anyway, it seem to successfully detect djvulibre installation, but it failed (or didn't try) to include c:\Program Files (x86)\DjVuLibre\include\libdjvu\ folder. If I copy libdjvu folder to d:\src\python-djvulibre\djvu\libdjvu then it doesn't complain about missing include, but as expected it fails and I guess the reason is wrong bitness.

  5. klo reporter

    I just found that I have 32 bit Python from ArcGis installation, and successfully build your code with 32 bit MinGW:

    D:\src\python-djvulibre>d:\Python27\ArcGIS10.2\python.exe setup.py build --compiler=mingw32
    pkg-config failed: Package ddjvuapi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `ddjvuapi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'ddjvuapi' found
    running build
    running build_py
    running build_ext
    building 'djvu.decode' extension
    d:\MinGW\bin\gcc.exe -mdll -O -Wall -Id:\Python27\ArcGIS10.2\include -Id:\Python27\ArcGIS10.2\PC -c djvu/decode.c -o build\temp.win32-2.7\Release\djvu\decode.o "-IC:\Program Files (x86)\DjVuLibre\include"
    djvu/decode.c: In function '__pyx_f_4djvu_6decode_get_type_name':
    djvu/decode.c:3172:11: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_r = ((PyTypeObject *)__pyx_v_type)->tp_name;
               ^
    djvu/decode.c: In function '__pyx_pf_4djvu_6decode_8Document_4save':
    djvu/decode.c:11742:190: warning: passing argument 4 of 'ddjvu_document_save' from incompatible pointer type [enabled by default]
         __pyx_t_3 = ((struct __pyx_vtabstruct_4djvu_6decode_SaveJob *)__pyx_v_job->__pyx_base.__pyx_vtab)->__pyx_base.__pyx___init(((struct __pyx_obj_4djvu_6decode_Job *)__pyx_v_job), ((struct __pyx_obj_4djvu_6decode_Context *)__pyx_t_4), ddjvu_document_save(__pyx_v_self->ddjvu_document, __pyx_v_output, __pyx_v_optc, __pyx_v_optv)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L12_error;}
    
                                                                          ^
    In file included from djvu/decode.c:345:0:
    djvu/libdjvu/ddjvuapi.h:1391:1: note: expected 'const char * const*' but argument is of type 'char **'
     ddjvu_document_save(ddjvu_document_t *document, FILE *output,
     ^
    djvu/decode.c: In function '__pyx_pf_4djvu_6decode_8Document_6export_ps':
    djvu/decode.c:13419:192: warning: passing argument 4 of 'ddjvu_document_print' from incompatible pointer type [enabled by default]
           __pyx_t_1 = ((struct __pyx_vtabstruct_4djvu_6decode_SaveJob *)__pyx_v_job->__pyx_base.__pyx_vtab)->__pyx_base.__pyx___init(((struct __pyx_obj_4djvu_6decode_Job *)__pyx_v_job), ((struct __pyx_obj_4djvu_6decode_Context *)__pyx_t_10), ddjvu_document_print(__pyx_v_self->ddjvu_document, __pyx_v_output, __pyx_v_optc, __pyx_v_optv)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L64_error;}
    
                                                                            ^
    In file included from djvu/decode.c:345:0:
    djvu/libdjvu/ddjvuapi.h:1364:1: note: expected 'const char * const*' but argument is of type 'char **'
     ddjvu_document_print(ddjvu_document_t *document, FILE *output,
     ^
    djvu/decode.c: In function '__pyx_pf_4djvu_6decode_11Annotations_16background_color___get__':
    djvu/decode.c:29948:18: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_v_result = ddjvu_anno_get_bgcolor(__pyx_v_self->_sexpr->_cexpr);
                      ^
    djvu/decode.c: In function '__pyx_pf_4djvu_6decode_11Annotations_4zoom___get__':
    djvu/decode.c:30044:18: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_v_result = ddjvu_anno_get_zoom(__pyx_v_self->_sexpr->_cexpr);
                      ^
    djvu/decode.c: In function '__pyx_pf_4djvu_6decode_11Annotations_4mode___get__':
    djvu/decode.c:30140:18: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_v_result = ddjvu_anno_get_mode(__pyx_v_self->_sexpr->_cexpr);
                      ^
    djvu/decode.c: In function '__pyx_pf_4djvu_6decode_11Annotations_16horizontal_align___get__':
    djvu/decode.c:30236:18: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_v_result = ddjvu_anno_get_horizalign(__pyx_v_self->_sexpr->_cexpr);
                      ^
    djvu/decode.c: In function '__pyx_pf_4djvu_6decode_11Annotations_14vertical_align___get__':
    djvu/decode.c:30332:18: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_v_result = ddjvu_anno_get_vertalign(__pyx_v_self->_sexpr->_cexpr);
                      ^
    djvu/decode.c: In function '__pyx_pf_4djvu_6decode_8Metadata_4__getitem__':
    djvu/decode.c:33105:13: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_v_s = ddjvu_anno_get_metadata(__pyx_v_self->_annotations->_sexpr->_cexpr, ((struct __pyx_vtabstruct_4djvu_5sexpr__WrappedCExpr *)__pyx_v_cexpr_key->__pyx_vtab)->cexpr(__pyx_v_cexpr_key));
                 ^
    djvu/decode.c: In function '__Pyx_RaiseArgtupleInvalid':
    djvu/decode.c:42160:18: warning: unknown conversion type character 'z' in format [-Wformat=]
                      (num_expected == 1) ? "" : "s", num_found);
                      ^
    djvu/decode.c:42160:18: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'Py_ssize_t' [-Wformat=]
    djvu/decode.c:42160:18: warning: unknown conversion type character 'z' in format [-Wformat=]
    djvu/decode.c:42160:18: warning: too many arguments for format [-Wformat-extra-args]
    djvu/decode.c: In function '__Pyx_RaiseTooManyValuesError':
    djvu/decode.c:42341:18: warning: unknown conversion type character 'z' in format [-Wformat=]
                      "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
                      ^
    djvu/decode.c:42341:18: warning: too many arguments for format [-Wformat-extra-args]
    djvu/decode.c: In function '__Pyx_RaiseNeedMoreValuesError':
    djvu/decode.c:42347:18: warning: unknown conversion type character 'z' in format [-Wformat=]
                      index, (index == 1) ? "" : "s");
                      ^
    djvu/decode.c:42347:18: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'Py_ssize_t' [-Wformat=]
    djvu/decode.c:42347:18: warning: too many arguments for format [-Wformat-extra-args]
    writing build\temp.win32-2.7\Release\djvu\decode.def
    d:\MinGW\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\djvu\decode.o build\temp.win32-2.7\Release\djvu\decode.def
    -Ld:\Python27\ArcGIS10.2\libs -Ld:\Python27\ArcGIS10.2\PCbuild -ldjvulibre -lpython27 -lmsvcr90 -o build\lib.win32-2.7\djvu\decode.pyd "-LC:\Program Files (x86)\DjVuLibre"
    cythoning 'djvu.sexpr' extension
    generating djvu/sexpr.c from djvu/sexpr.pyx, djvu/config.pxi, djvu/common.pxi, djvu\decode.pxd, djvu\sexpr.pxd
    C:\Python27\Scripts\cython.exe djvu/sexpr.pyx
    building 'djvu.sexpr' extension
    d:\MinGW\bin\gcc.exe -mdll -O -Wall -Id:\Python27\ArcGIS10.2\include -Id:\Python27\ArcGIS10.2\PC -c djvu/sexpr.c -o build\temp.win32-2.7\Release\djvu\sexpr.o "-IC:\Program Files (x86)\DjVuLibre\include"
    djvu/sexpr.c: In function '__pyx_f_4djvu_5sexpr_get_type_name':
    djvu/sexpr.c:1638:11: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_r = ((PyTypeObject *)__pyx_v_type)->tp_name;
               ^
    djvu/sexpr.c: In function '__pyx_f_4djvu_5sexpr_myio_set':
    djvu/sexpr.c:1979:40: warning: assignment from incompatible pointer type [enabled by default]
       __pyx_v_4djvu_5sexpr__backup_io_puts = minilisp_puts;
                                            ^
    djvu/sexpr.c:2121:19: warning: assignment from incompatible pointer type [enabled by default]
         minilisp_puts = __pyx_f_4djvu_5sexpr__myio_puts;
                       ^
    djvu/sexpr.c: In function '__pyx_f_4djvu_5sexpr_myio_reset':
    djvu/sexpr.c:2238:17: warning: assignment from incompatible pointer type [enabled by default]
       minilisp_puts = __pyx_v_4djvu_5sexpr__backup_io_puts;
                     ^
    djvu/sexpr.c: In function '__pyx_pf_4djvu_5sexpr_16StringExpression_2_get_value':
    djvu/sexpr.c:7942:17: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
       __pyx_v_bytes = miniexp_to_str(((struct __pyx_vtabstruct_4djvu_5sexpr__WrappedCExpr *)__pyx_v_self->wexpr->__pyx_vtab)->cexpr(__pyx_v_self->wexpr));
                     ^
    djvu/sexpr.c: In function '__Pyx_RaiseArgtupleInvalid':
    djvu/sexpr.c:16739:18: warning: unknown conversion type character 'z' in format [-Wformat=]
                      (num_expected == 1) ? "" : "s", num_found);
                      ^
    djvu/sexpr.c:16739:18: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'Py_ssize_t' [-Wformat=]
    djvu/sexpr.c:16739:18: warning: unknown conversion type character 'z' in format [-Wformat=]
    djvu/sexpr.c:16739:18: warning: too many arguments for format [-Wformat-extra-args]
    writing build\temp.win32-2.7\Release\djvu\sexpr.def
    d:\MinGW\bin\gcc.exe -shared -s build\temp.win32-2.7\Release\djvu\sexpr.o build\temp.win32-2.7\Release\djvu\sexpr.def -Ld:\Python27\ArcGIS10.2\libs -Ld:\Python27\ArcGIS10.2\PCbuild -ldjvulibre -lpython27 -lmsvcr90 -o build\lib.win32-2.7\djvu\sexpr.pyd "-LC:\Program Files (x86)\DjVuLibre"
    

    and then:

    D:\src\python-djvulibre>d:\Python27\ArcGIS10.2\python.exe setup.py install
    pkg-config failed: Package ddjvuapi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `ddjvuapi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'ddjvuapi' found
    running install
    running bdist_egg
    running egg_info
    creating python_djvulibre.egg-info
    writing dependency_links to python_djvulibre.egg-info\dependency_links.txt
    writing python_djvulibre.egg-info\PKG-INFO
    writing top-level names to python_djvulibre.egg-info\top_level.txt
    writing manifest file 'python_djvulibre.egg-info\SOURCES.txt'
    reading manifest file 'python_djvulibre.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'python_djvulibre.egg-info\SOURCES.txt'
    installing library code to build\bdist.win32\egg
    running install_lib
    running build_py
    running build_ext
    creating build\bdist.win32
    creating build\bdist.win32\egg
    creating build\bdist.win32\egg\djvu
    copying build\lib.win32-2.7\djvu\const.py -> build\bdist.win32\egg\djvu
    copying build\lib.win32-2.7\djvu\decode.pyd -> build\bdist.win32\egg\djvu
    copying build\lib.win32-2.7\djvu\dllpath.py -> build\bdist.win32\egg\djvu
    copying build\lib.win32-2.7\djvu\sexpr.pyd -> build\bdist.win32\egg\djvu
    copying build\lib.win32-2.7\djvu\__init__.py -> build\bdist.win32\egg\djvu
    byte-compiling build\bdist.win32\egg\djvu\const.py to const.pyc
    byte-compiling build\bdist.win32\egg\djvu\dllpath.py to dllpath.pyc
    byte-compiling build\bdist.win32\egg\djvu\__init__.py to __init__.pyc
    creating stub loader for djvu\decode.pyd
    creating stub loader for djvu\sexpr.pyd
    byte-compiling build\bdist.win32\egg\djvu\decode.py to decode.pyc
    byte-compiling build\bdist.win32\egg\djvu\sexpr.py to sexpr.pyc
    creating build\bdist.win32\egg\EGG-INFO
    copying python_djvulibre.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
    copying python_djvulibre.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
    copying python_djvulibre.egg-info\dependency_links.txt -> build\bdist.win32\egg\EGG-INFO
    copying python_djvulibre.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
    writing build\bdist.win32\egg\EGG-INFO\native_libs.txt
    zip_safe flag not set; analyzing archive contents...
    creating dist
    creating 'dist\python_djvulibre-0.3.10-py2.7-win32.egg' and adding 'build\bdist.win32\egg' to it
    removing 'build\bdist.win32\egg' (and everything under it)
    Processing python_djvulibre-0.3.10-py2.7-win32.egg
    Copying python_djvulibre-0.3.10-py2.7-win32.egg to d:\python27\arcgis10.2\lib\site-packages
    Adding python-djvulibre 0.3.10 to easy-install.pth file
    
    Installed d:\python27\arcgis10.2\lib\site-packages\python_djvulibre-0.3.10-py2.7-win32.egg
    Processing dependencies for python-djvulibre==0.3.10
    Finished processing dependencies for python-djvulibre==0.3.10
    
    D:\src\python-djvulibre>d:\Python27\ArcGIS10.2\python.exe
    Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import djvu
    >>> dir(djvu)
    ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__']
    >>>
    
  6. Log in to comment