contentauth / c2pa-python

Python binding for c2pa-rs library
Apache License 2.0
23 stars 7 forks source link

Linux builds do not install and report an undefined symbol error #5

Closed gpeacock closed 7 months ago

gpeacock commented 8 months ago

[ERROR] AttributeError: /usr/local/lib/python3.12/site-packages/c2pa_python/libuniffi_c2pa.so: undefined symbol: uniffi_c2pa_python_fn_func_read_file

gpeacock commented 8 months ago

This is fixed with the 0.4.0 build. The issue was that uniffi was using the library name on linux for the symbol names, so that the internal names used c2pa_python instead of c2pa. The fix is to rename the library to c2pa. This breaks compatibility since you now need to use: import c2pa instead of import c2pa_python as c2pa. The example code and tests have been updated for thisl

rabb1t-dev commented 7 months ago

I tried the linux_c2pa_fix branch and got a similar error running pytest:

$ pytest
=========================================== test session starts ============================================
platform linux -- Python 3.11.2, pytest-7.4.4, pluggy-1.4.0
rootdir: /home/jeff/c2pa-python
collected 0 items / 1 error

================================================== ERRORS ==================================================
___________________________________ ERROR collecting tests/test_c2pa.py ____________________________________
tests/test_c2pa.py:14: in <module>
    import c2pa
.venv/lib/python3.11/site-packages/c2pa/__init__.py:1: in <module>
    from .c2pa import *  # NOQA
.venv/lib/python3.11/site-packages/c2pa/c2pa.py:571: in <module>
    _UniffiLib.ffi_c2pa_rust_future_continuation_callback_set.argtypes = (
/usr/lib/python3.11/ctypes/__init__.py:389: in __getattr__
    func = self.__getitem__(name)
/usr/lib/python3.11/ctypes/__init__.py:394: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /home/jeff/c2pa-python/.venv/lib/python3.11/site-packages/c2pa/libuniffi_c2pa.so: undefined symbol: ffi_c2pa_rust_future_continuation_callback_set
========================================= short test summary info ==========================================
ERROR tests/test_c2pa.py - AttributeError: /home/jeff/c2pa-python/.venv/lib/python3.11/site-packages/c2pa/libuniffi_c2pa.so: undef...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================= 1 error in 0.08s =============================================
Aliiiqbp commented 7 months ago

This is fixed with the 0.4.0 build. The issue was that uniffi was using the library name on linux for the symbol names, so that the internal names used c2pa_python instead of c2pa. The fix is to rename the library to c2pa. This breaks compatibility since you now need to use: import c2pa instead of import c2pa_python as c2pa. The example code and tests have been updated for this

I tried to install version 0.4.0, but this version has not yet been published. """ ERROR: Could not find a version that satisfies the requirement c2pa-python==0.4.0 (from versions: 0.1.0, 0.2.0, 0.2.1, 0.2.2, 0.3.0, 0.3.1) ERROR: No matching distribution found for c2pa-python==0.4.0 """

rabb1t-dev commented 7 months ago

Still seeing this error in 0.4.0:

E   AttributeError: /home/jeff/c2pa-python/.venv/lib/python3.11/site-packages/c2pa/libuniffi_c2pa.so: undefined symbol: ffi_c2pa_rust_future_poll_u8
dkozma commented 7 months ago

Hello, can you please try again? There was an issue publishing 0.4.0 to PyPi that should now be resolved: https://pypi.org/project/c2pa-python/0.4.0/

dkozma commented 7 months ago

Also to note - you might have to do a reinstall / force install of 0.4.0 to make sure it overwrites the previous version.

rabb1t-dev commented 7 months ago

It works for me now. Thank you!

dkozma commented 7 months ago

Closing this issue - please feel free to reopen if any other issues are encountered.