[cairo-bugs] [Bug 72094] New: Python fails when loading Cairo dll: OSError 0x7e

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Nov 27 18:49:13 PST 2013


https://bugs.freedesktop.org/show_bug.cgi?id=72094

          Priority: medium
            Bug ID: 72094
          Assignee: cairo-bugs at cairographics.org
           Summary: Python fails when loading Cairo dll: OSError 0x7e
        QA Contact: cairo-bugs at cairographics.org
          Severity: major
    Classification: Unclassified
                OS: Windows (All)
          Reporter: erik.norvelle at neomailbox.net
          Hardware: x86-64 (AMD64)
            Status: NEW
           Version: unspecified
         Component: win32 backend
           Product: cairo

I run Python 3.3 (Anaconda distribution) under Windows 7, 64-bit. I have
attempted to install the Weasyprint app/library, which has a number of
dependencies, of which Cairo is one. I have put a lot of work into solving this
problem, which I summarize below. I have attempted to be totally complete with
this bug report, so I would appreciate your taking a close look.

The environment I have is as follows: Windows 7 SP1 64-bit, Python 3.3 64 bit
(CPython, as compiled and distributed by the www.python.org site), CFFI
compiled (by me) under Visual Studio 2010 with a 64-bit environment, and
Cairo's libcairo-2.dll also in the 64-bit version available from
cairographics.org. From what I can tell, my version of the Cairo dll (which is
the one I downloaded from the cairographics.org site) was compiled under Visual
Studio 2008, which appears to be causing the problem. [This is only my guess, I
am NOT an expert Windows programmer]

When I run weasyprint, it chokes during the import loading process,
specifically when it calls CFFI (a DLL loader for Python) in order to load the
GTK+-compatible library dll for Cairo. The error that I get is as follows:

$ weasyprint
Traceback (most recent call last):
  File
"c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py",
line 399, in _make_ffi_library
    backendlib = backend.load_library(name, flags)
OSError: cannot load library libcairo-2.dll: error 0x7e

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Anaconda\envs\py33\Scripts\weasyprint-script.py", line 9, in
<module>
    load_entry_point('WeasyPrint==0.20', 'console_scripts', 'weasyprint')()
  File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 343, in
load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 2355,
in load_entry_point
    return ep.load()
  File "C:\Anaconda\envs\py33\lib\site-packages\pkg_resources.py", line 2061,
in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File
"c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\__init__.py",
line 309, in <module>
    from .css import PARSER, preprocess_stylesheet
  File
"c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\css\__init__.py",
line 30, in <module>
    from . import computed_values
  File
"c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\css\computed_values.py",
line 18, in <module>
    from .. import text
  File
"c:\anaconda\envs\py33\lib\site-packages\weasyprint-0.20-py3.3.egg\weasyprint\text.py",
line 18, in <module>
    import cairocffi as cairo
  File
"c:\anaconda\envs\py33\lib\site-packages\cairocffi-0.5.1-py3.3.egg\cairocffi\__init__.py",
line 39, in <module>
    cairo = dlopen(ffi, 'libcairo-2.dll', 'cairo', 'libcairo-2')
  File
"c:\anaconda\envs\py33\lib\site-packages\cairocffi-0.5.1-py3.3.egg\cairocffi\__init__.py",
line 34, in dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
  File
"c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py",
line 117, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File
"c:\anaconda\envs\py33\lib\site-packages\cffi-0.8-py3.3-win-amd64.egg\cffi\api.py",
line 405, in _make_ffi_library
    backendlib = backend.load_library(path, flags)
OSError: cannot load library C:\Windows\system32\libcairo-2.dll: error 0x7e 

I have tried to rebuild the Cairo library using the "end to end" instructions,
but the instructions are for use under Visual Studio 2008, and I have Visual
Studio Express 2010 (with Windows SDK 7.1 installed), which does not have
vcbuild.exe, and as a result I cannot follow the instructions given at
http://cairographics.org/end_to_end_build_for_win32/). Furthermore, because my
Python was built with VS 2010, I believe I am obligated to use a Cairo DLL
compiled with the same version. Correct me if I am wrong.

I am not a Windows programmer, and am only delving into this mess because I
want to get Weasyprint to work for another (Python language) project. I have
done a minor bit of Windows programming a long time ago under Delphi, so I have
a vague grasp of how this stuff works, but I have been unable to solve this
problem.

I would be happy to put the work into compiling Cairo for my
platform/configuration, and would make the resulting file(s) available for
redistribution, but I will need at least some assistance in doing so.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo-bugs/attachments/20131128/adc69be7/attachment.html>


More information about the cairo-bugs mailing list