jd-boyd / python-lzo

Python bindings for the LZO data compression library
GNU General Public License v2.0
74 stars 41 forks source link

v1.15 breaks build on #74

Closed DeusExLibris closed 1 year ago

DeusExLibris commented 1 year ago

We use python-lzo for decompressing files in Apache Airflow 2.4.3 on Amazon Managed Workflow for Apache Airflow (MWAA). This was working fine until v1.15 was released and we started getting the following error when installing requirements.txt:

  error: subprocess-exited-with-error
  Building wheel for python-lzo (pyproject.toml) did not run successfully.
  exit code: 1
  [29 lines of output]
    lzomodule.c: In function 'compress':
    lzomodule.c:111:5: error: unknown type name 'lzo_uint32_t'; did you mean 'lzo_uint32'?
         lzo_uint32_t MEM_COMPRESS_1;
         ^~~~~~~~~~~~
         lzo_uint32
    lzomodule.c:112:5: error: unknown type name 'lzo_uint32_t'; did you mean 'lzo_uint32'?
         lzo_uint32_t MEM_COMPRESS_999;
         ^~~~~~~~~~~~
         lzo_uint32
    lzomodule.c:121:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (len > LZO_UINT_MAX) {
                 ^
    lzomodule.c:126:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if ((len + len / 16 + 64 + 3) > LZO_UINT_MAX) {
                                       ^
    lzomodule.c: In function 'optimize':
    lzomodule.c:453:44: warning: pointer targets in passing argument 1 of 'PyBytes_FromStringAndSize' differ in signedness [-Wpointer-sign]
         result_str = PyBytes_FromStringAndSize(in, len);
                                                ^~
    In file included from /usr/include/python3.10/Python.h:82:0,
                     from lzomodule.c:36:
    /usr/include/python3.10/bytesobject.h:34:24: note: expected 'const char *' but argument is of type 'unsigned char *'
     PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~
    At top level:
    lzomodule.c:577:25: warning: 'module_documentation' defined but not used [-Wunused-variable]
     static /* const */ char module_documentation[]=
                             ^~~~~~~~~~~~~~~~~~~~
    error: command '/usr/bin/gcc' failed with exit code 1

I was able to resolve this issue by forcing pip to use v1.14 in the requirements.txt file:

git+https://github.com/jd-boyd/python-lzo.git@v1.14

Amazon does not release a lot of information about the underlying container but I am fairly certain that it is running on Amazon Linux 2 and Python 3.10.

I was able to install via command line on a standalone Amazon Linux 2023 EC2 instance but I am unable to determine why this is the case since I can't create a standalone instance of the MWAA container image.

I am hoping that the error will provide enough information for you to address this. In the meantime, we will continue to use v1.14.

AT0myks commented 1 year ago

What's the version of the lzo-devel package? I've seen this exact issue on a system where the latest version of lzo is 2.06 which is not compatible with recent versions of python-lzo that expects 2.10. But that still doesn't explain why 1.14 works when there hasn't been any obvious change in setup.py. Does it work if instead you use this wheel in your requirements.txt? See #75 for more details.