CESNET/libyang-python

libyang-python 2.5.1 does not build with latest libyang 2.1.4

Closed this issue · 0 comments

pip3 install --upgrade libyang      
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: libyang in /usr/local/lib/python3.10/dist-packages (2.1.0)
Collecting libyang
  Using cached libyang-2.5.1.tar.gz (45 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: cffi in /home/vm/.local/lib/python3.10/site-packages (from libyang) (1.15.1)
Requirement already satisfied: pycparser in /usr/lib/python3/dist-packages (from cffi->libyang) (2.21)
Building wheels for collected packages: libyang
  Building wheel for libyang (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for libyang (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-310
      creating build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/__init__.py -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/util.py -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/keyed_list.py -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/schema.py -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/log.py -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/diff.py -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/xpath.py -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/context.py -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/data.py -> build/lib.linux-x86_64-cpython-310/libyang
      running egg_info
      writing libyang.egg-info/PKG-INFO
      writing dependency_links to libyang.egg-info/dependency_links.txt
      writing requirements to libyang.egg-info/requires.txt
      writing top-level names to libyang.egg-info/top_level.txt
      reading manifest file 'libyang.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'libyang.egg-info/SOURCES.txt'
      copying libyang/VERSION -> build/lib.linux-x86_64-cpython-310/libyang
      copying libyang/py.typed -> build/lib.linux-x86_64-cpython-310/libyang
      running build_ext
      generating cffi module 'build/temp.linux-x86_64-cpython-310/_libyang.c'
      creating build/temp.linux-x86_64-cpython-310
      building '_libyang' extension
      creating build/temp.linux-x86_64-cpython-310/build
      creating build/temp.linux-x86_64-cpython-310/build/temp.linux-x86_64-cpython-310
      x86_64-linux-gnu-gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/usr/include/python3.10 -c build/temp.linux-x86_64-cpython-310/_libyang.c -o build/temp.linux-x86_64-cpython-310/build/temp.linux-x86_64-cpython-310/_libyang.o -Werror -std=c99
      build/temp.linux-x86_64-cpython-310/_libyang.c: In function ‘_cffi_checkfld_struct_lysc_ext_instance’:
      build/temp.linux-x86_64-cpython-310/_libyang.c:8235:21: error: ‘struct lysc_ext_instance’ has no member named ‘data’
       8235 |   { void * *tmp = &p->data; (void)tmp; }
            |                     ^~
      build/temp.linux-x86_64-cpython-310/_libyang.c: In function ‘_cffi_checkfld_struct_lysp_ext_instance’:
      build/temp.linux-x86_64-cpython-310/_libyang.c:8544:31: error: initialization of ‘struct lysp_node **’ from incompatible pointer type ‘void **’ [-Werror=incompatible-pointer-types]
       8544 |   { struct lysp_node * *tmp = &p->parsed; (void)tmp; }
            |                               ^
      In file included from /usr/include/x86_64-linux-gnu/bits/socket.h:27,
                       from /usr/include/x86_64-linux-gnu/sys/socket.h:33,
                       from /usr/include/netinet/in.h:23,
                       from /usr/include/arpa/inet.h:22,
                       from /usr/local/include/libyang/tree_data.h:23,
                       from /usr/local/include/libyang/context.h:22,
                       from /usr/local/include/libyang/libyang.h:25,
                       from build/temp.linux-x86_64-cpython-310/_libyang.c:574:
      build/temp.linux-x86_64-cpython-310/_libyang.c: At top level:
      build/temp.linux-x86_64-cpython-310/_libyang.c:9455:13: error: ‘struct lysc_ext_instance’ has no member named ‘data’
       9455 |   { "data", offsetof(struct lysc_ext_instance, data),
            |             ^~~~~~~~
      build/temp.linux-x86_64-cpython-310/_libyang.c:9456:51: error: ‘struct lysc_ext_instance’ has no member named ‘data’
       9456 |             sizeof(((struct lysc_ext_instance *)0)->data),
            |                                                   ^~
      cc1: all warnings being treated as errors
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for libyang
Failed to build libyang
ERROR: Could not build wheels for libyang, which is required to install pyproject.toml-based projects

builds fine with 2.0.231: https://github.com/CESNET/libyang/releases

Commit that caused this:

CESNET/libyang@193dacd

changed inside struct lysc_ext_instance the void *data to void *compiled (amongst other changes):

https://github.com/CESNET/libyang/blob/193dacdfac53bb635b794a5e4a68e74c614ff497/src/plugins_exts.h#L442