Kozea / cairocffi

CFFI-based cairo bindings for Python.
https://doc.courtbouillon.org/cairocffi
BSD 3-Clause "New" or "Revised" License
206 stars 53 forks source link

cairocffi_to_pycairo doesn't work in fedora #78

Open stuaxo opened 8 years ago

stuaxo commented 8 years ago

On fedora (disclaimer: not usually a fedora user) - cairocffi_to_pycairo.py doesn't seem to work

 $ python -c 'from cairocffi_to_pycairo.py import *'
[devel@b1e68ff9c787 utils]$ python -c 'from cairocffi_to_pycairo.py import *'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "cairocffi_to_pycairo.py", line 8, in <module>
    pycairo.PycairoContext_FromContext.restype = ctypes.c_void_p
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 373, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib64/python2.7/ctypes/__init__.py", line 378, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib64/python2.7/site-packages/cairo/_cairo.so: undefined symbol: PycairoContext_FromContext

I've made a Dockerfile that can repro the issue https://github.com/stuaxo/docker-fedora-cairocffi-bug run ./build.sh then ./run.sh

SimonSapin commented 8 years ago

Can you check what symbols are in the .so file?

readelf -Ws /usr/lib64/python2.7/site-packages/cairo/_cairo.so

(I don’t know how to use Docker, and I’m not all that interested.)

stuaxo commented 8 years ago

Here you go -

$ readelf -Ws /usr/lib64/python2.7/site-packages/cairo/_cairo.so

Symbol table '.dynsym' contains 280 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000007da0     0 SECTION LOCAL  DEFAULT    9 
     2: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_copy_path_flat
     3: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_line_join
     4: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scaled_font_status
     5: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_rel_line_to
     6: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyList_New
     7: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_invert
     8: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_copy_page
     9: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_version_string
    10: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyExc_SystemError
    11: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_set_device_offset
    12: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_xlib_surface_get_width
    13: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_tolerance
    14: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_clip
    15: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_set_extend
    16: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _Py_ZeroStruct
    17: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyModule_AddIntConstant
    18: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_font_size
    19: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_user_to_device
    20: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_set_filter
    21: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_tolerance
    22: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_AsWriteBuffer
    23: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_push_group_with_content
    24: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_create
    25: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_create_linear
    26: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_font_options
    27: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_deregisterTMCloneTable
    28: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_add_color_stop_rgba
    29: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyGILState_Release
    30: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_get_surface
    31: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_font_matrix
    32: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyInt_AsLong
    33: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_dsc_comment
    34: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_new_path
    35: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_get_filter
    36: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_init_rotate
    37: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_write_to_png
    38: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyEval_RestoreThread
    39: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_status
    40: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scaled_font_get_scale_matrix
    41: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_add_color_stop_rgb
    42: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_destroy
    43: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyMem_Free
    44: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_get_extend
    45: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_get_radial_circles
    46: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_rectangle_list_destroy
    47: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_AsReadBuffer
    48: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_destroy
    49: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND Py_InitModule4_64
    50: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_GetAttrString
    51: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_font_face
    52: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_miter_limit
    53: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_toy_font_face_create
    54: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_create
    55: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_format_stride_for_width
    56: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_rotate
    57: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_font_options
    58: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_glyph_extents
    59: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_device_to_user
    60: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_line_width
    61: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_get_data
    62: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_get_rgba
    63: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_init
    64: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_get_type
    65: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_mark_dirty
    66: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_get_fallback_resolution
    67: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyErr_NoMemory
    68: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_paint_with_alpha
    69: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_scaled_font
    70: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_font_face
    71: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _Py_NotImplementedStruct
    72: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND Py_FileSystemDefaultEncoding
    73: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_destroy
    74: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_get_device_offset
    75: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_source
    76: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_dash_count
    77: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_toy_font_face_get_slant
    78: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_scale
    79: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_fill
    80: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_clip_preserve
    81: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_get_font_options
    82: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __stack_chk_fail@GLIBC_2.4 (2)
    83: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyExc_RuntimeError
    84: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scaled_font_get_font_face
    85: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_face_destroy
    86: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scaled_font_reference
    87: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_status
    88: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_status
    89: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_SelfIter
    90: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyErr_SetString
    91: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_xlib_surface_get_depth
    92: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_transform_distance
    93: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_create_radial
    94: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_rel_curve_to
    95: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_close_path
    96: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_create_for_stream
    97: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_create
    98: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_antialias
    99: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_svg_surface_create
   100: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_get_subpixel_order
   101: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyExc_ValueError
   102: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_text_path
   103: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_get_matrix
   104: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyExc_TypeError
   105: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_dsc_begin_page_setup
   106: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND __assert_fail@GLIBC_2.2.5 (3)
   107: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyGILState_Ensure
   108: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_xlib_surface_get_height
   109: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_write_to_png_stream
   110: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_append_path
   111: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_user_to_device_distance
   112: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_create_rgba
   113: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_create_for_data
   114: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_svg_surface_create_for_stream
   115: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_flush
   116: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_set_antialias
   117: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyOS_snprintf
   118: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_miter_limit
   119: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyObject_Free
   120: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyFloat_FromDouble
   121: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_path_destroy
   122: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyCObject_Import
   123: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_line_cap
   124: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyType_Ready
   125: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_show_page
   126: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pdf_surface_create_for_stream
   127: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_restrict_to_level
   128: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_curve_to
   129: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_copy_clip_rectangle_list
   130: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_status
   131: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyErr_NewException
   132: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_line_cap
   133: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_has_current_point
   134: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_dash
   135: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_get_content
   136: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyList_Append
   137: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_path_extents
   138: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_set_hint_style
   139: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_antialias
   140: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_transform_point
   141: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_get_width
   142: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_font_matrix
   143: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_rectangle
   144: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyString_FromString
   145: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyExc_IOError
   146: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_copy_path
   147: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_create_from_png_stream
   148: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_in_fill
   149: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyCObject_FromVoidPtr
   150: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_get_eps
   151: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_multiply
   152: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_dsc_begin_setup
   153: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_stroke_extents
   154: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND __gmon_start__
   155: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyTuple_New
   156: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND memcpy@GLIBC_2.14 (4)
   157: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_source_rgb
   158: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_line_to
   159: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_fill_rule
   160: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_toy_font_face_get_family
   161: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_scaled_font
   162: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyErr_Occurred
   163: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyImport_ImportModule
   164: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_reference
   165: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_fill_rule
   166: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_get_hint_metrics
   167: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_source_rgba
   168: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_get_hint_style
   169: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyDict_GetItemString
   170: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _PyObject_CallMethod_SizeT
   171: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_arc_negative
   172: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_get_height
   173: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_arc
   174: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scaled_font_destroy
   175: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _PyArg_ParseTuple_SizeT
   176: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_matrix
   177: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_transform
   178: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _Py_NoneStruct
   179: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_operator
   180: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_destroy
   181: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_xcb_surface_create
   182: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyFloat_AsDouble
   183: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_push_group
   184: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_set_size
   185: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_dash
   186: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_extents
   187: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_create_similar
   188: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scale
   189: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_copy_page
   190: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _PyArg_ParseTupleAndKeywords_SizeT
   191: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_face_get_type
   192: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyBuffer_FromReadWriteObject
   193: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pop_group_to_source
   194: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _Py_TrueStruct
   195: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_create_from_png
   196: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_line_width
   197: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_reference
   198: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_translate
   199: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyExc_IndexError
   200: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_translate
   201: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyBool_Type
   202: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_mask
   203: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyCallable_Check
   204: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_text_extents
   205: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_line_join
   206: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_move_to
   207: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_source
   208: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_set_fallback_resolution
   209: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_show_text
   210: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _PyErr_BadInternalCall
   211: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_current_point
   212: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_get_type
   213: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_finish
   214: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scaled_font_create
   215: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_operator
   216: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_in_stroke
   217: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _PyObject_New
   218: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_reset_clip
   219: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyString_AsStringAndSize
   220: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_restore
   221: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_rel_move_to
   222: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyModule_AddStringConstant
   223: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyInt_FromLong
   224: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyEval_SaveThread
   225: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyModule_AddObject
   226: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_create_for_surface
   227: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pdf_surface_set_size
   228: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_toy_font_face_get_weight
   229: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scaled_font_extents
   230: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _Jv_RegisterClasses
   231: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_surface_set_eps
   232: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_surface_mark_dirty_rectangle
   233: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_set_source_surface
   234: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_matrix
   235: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_clip_extents
   236: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_device_to_user_distance
   237: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_face_reference
   238: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_show_glyphs
   239: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_matrix_rotate
   240: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_fill_preserve
   241: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_mask_surface
   242: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyType_IsSubtype
   243: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_stroke
   244: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_paint
   245: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_xcb_surface_set_size
   246: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_set_matrix
   247: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_save
   248: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_get_stride
   249: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_glyph_path
   250: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _Py_BuildValue_SizeT
   251: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_version
   252: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_status_to_string
   253: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyModule_GetDict
   254: 0000000000000000     0 NOTYPE  WEAK   DEFAULT  UND _ITM_registerTMCloneTable
   255: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_face_status
   256: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_group_target
   257: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_ps_level_to_string
   258: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_new_sub_path
   259: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_identity_matrix
   260: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_set_subpixel_order
   261: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_select_font_face
   262: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_set_hint_metrics
   263: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_font_options_get_antialias
   264: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyBaseString_Type
   265: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PyMem_Malloc
   266: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_scaled_font_text_extents
   267: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _PyString_Join
   268: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_stroke_preserve
   269: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pattern_get_linear_points
   270: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND __cxa_finalize@GLIBC_2.2.5 (3)
   271: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_show_page
   272: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_image_surface_get_format
   273: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pdf_surface_create
   274: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_get_target
   275: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_create
   276: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_fill_extents
   277: 0000000000000000     0 FUNC    GLOBAL DEFAULT  UND cairo_pop_group
   278: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND PySequence_Fast
   279: 0000000000009040  2811 FUNC    GLOBAL DEFAULT   11 init_cairo
SimonSapin commented 8 years ago

On my system this shows a number of symbols that start with Pycairo for the C API: http://cairographics.org/documentation/pycairo/2/pycairo_c_api.html

I don’t know where they are on your system, but that’s not something cairocffi can do anything about.

stuaxo commented 8 years ago

My real system is Ubuntu and readelf looks a lot more sane. For my own use, turns out I wasn't using this code.

It looks like a bug in fedora, but not being a fedora user I don't know where to start upstreaming this bug.

Possibly worth closing until an actual fedora user hits this, then get them to whoever packages cairo for fedora.

stuaxo commented 8 years ago

Bah, spoke to soon - I do use that function ... but not fedora. Will either refactor code to just do this in the other direction or work out something else :)

SimonSapin commented 8 years ago

Maybe write a module in C that uses pycairo’s C API to see if it works on Fedora and sees what .so files it loads?

stuaxo commented 8 years ago

I've never tried writing a C module before, but might give it a go. In the meantime, I'll try this with a standard non-docker VM and see if it works.

It's weird - as I installed pycairo + cairocffi using their standard package manager - ie dnf install -y python-cairocffi dnf install -y python-pycairo, I would expect them to just work, but maybe it's something wrong with my setup.

stuaxo commented 8 years ago

Another data-point: got the same thing happen on Windows... (maybe I can use dependency walker to check what symbols are available, but it's not something I'm familiar with).

To get a cairo dll there, I have installed the pygtk-all-in-one installer, though my codebase is Gtk3, so I use pygobject for windows: http://opensourcepack.blogspot.co.uk/p/pygobject-pygi-aio.html for that.

Will see what they say on the cairo mailing list.

stuaxo commented 8 years ago

It seems to be the same .so in Fedora, and not be available. I can only think that something must have changed in the way cairo was built that is making the symbol not show up. Next step I'll try and build cairo in a fedora vm and see if the symbol is available.

I'm also wondering if it will be possible to implement this in an alternate way using some of the other Py* functions.

SimonSapin commented 8 years ago

Note that it’s a question of how pycairo is built, not cairo. They are two separate projects with their own source repositories, and are typically packaged separately in distributions.

PycairoContext_FromContext is defined here: https://cgit.freedesktop.org/py2cairo/tree/src/context.c#n38 . You may be able to duplicate it in Python + ctypes, but that sounds very brittle, on top of the already-brittle cairocffi_to_pycairo hack.

lazka commented 7 years ago

Here is some code implementing the pycairo->cairocffi conversion using only the public API: https://github.com/pygobject/pycairo/issues/59#issuecomment-316442034

Feel free to use it under the cairocffi license.

stuaxo commented 5 years ago

Great, @lazka's version works, I will see if I can make a PR of it.

stuaxo commented 5 years ago

Looks like the one on bpaste disappeared (I really should have taken a copy of that a the time, doh)

riaqn commented 2 years ago

Hello, what's the status on this? I'm having a similar issue: PycairoContext_FromContext is not in the pycairo .so file - any ideas? My guess is that those functions are not used inside pycairo and thus optimized out?