[Buildroot] [PATCH v4 1/2] package/libgpiod2: new package
Marcus Hoffmann
buildroot at bubu1.eu
Mon Jan 29 18:16:54 UTC 2024
Hi Boerge,
I finally got around to testing this. The python bindings don't work for
me, see below for a possible solution.
On 23.01.24 16:58, Boerge Struempfel wrote:
> From: Boerge Struempfel <boerge.struempfel at gmail.com>
>
> Due to a significant api change as well as more recent kernel version
> requirements, we introduce a separate package for version 2.0 and higher.
> The newpackage is incompatible to libgpiod 1.x. This allows for iteratively
> updating all dependent packages without breaking anything as a result.
>
> For now we will have libgpiod2 depend on !libgpiod. However, in the
> future, it might be preferable to have it the other way around,
> such that packages, which select libgpiod2 don't have to also add the
> the !libgpiod dependency.
>
> Note that this package does not correspond to the debian libgpiod2 package,
> which currently uses only version 1.6.3
>
> Signed-off-by: Boerge Struempfel <bstruempfel at ultratronik.de>
> ---
> DEVELOPERS | 3 +++
> package/Config.in | 1 +
> package/libgpiod2/Config.in | 27 +++++++++++++++++++++
> package/libgpiod2/libgpiod2.hash | 4 ++++
> package/libgpiod2/libgpiod2.mk | 41 ++++++++++++++++++++++++++++++++
> 5 files changed, 76 insertions(+)
> create mode 100644 package/libgpiod2/Config.in
> create mode 100644 package/libgpiod2/libgpiod2.hash
> create mode 100644 package/libgpiod2/libgpiod2.mk
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 9528837dd0..7a9d33c911 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -522,6 +522,9 @@ N: Bilal Wasim <bilalwasim676 at gmail.com>
> F: board/chromebook/elm/
> F: configs/chromebook_elm_defconfig
>
> +N: Boerge Struempfel <boerge.struempfel at gmail.com>
> +F: package/libgpiod2/
> +
> N: Bogdan Radulescu <bogdan at nimblex.net>
> F: package/iftop/
> F: package/ncdu/
> diff --git a/package/Config.in b/package/Config.in
> index 5b8b15fa54..b1adb18877 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -1748,6 +1748,7 @@ menu "Hardware handling"
> source "package/libftdi1/Config.in"
> source "package/libgphoto2/Config.in"
> source "package/libgpiod/Config.in"
> + source "package/libgpiod2/Config.in"
> source "package/libgudev/Config.in"
> source "package/libhid/Config.in"
> source "package/libiio/Config.in"
> diff --git a/package/libgpiod2/Config.in b/package/libgpiod2/Config.in
> new file mode 100644
> index 0000000000..9775ed42f9
> --- /dev/null
> +++ b/package/libgpiod2/Config.in
> @@ -0,0 +1,27 @@
> +config BR2_PACKAGE_LIBGPIOD2
> + bool "libgpiod2"
> + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_10
> + depends on !BR2_PACKAGE_LIBGPIOD
> + help
> + This is a C library that abstracts the GPIO character
> + device operations on linux.
> +
> + https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/
> +
> + This package is the continuation of the libgpiod package
> + for versions 2.0 and above.
> +
> + Note that a kernel of 5.10 or above is required for the
> + ioctls to work.
> +
> +if BR2_PACKAGE_LIBGPIOD2
> +
> +config BR2_PACKAGE_LIBGPIOD2_TOOLS
> + bool "install tools"
> + help
> + Include a set of command-line tools for managing GPIOs.
> +
> +endif
> +
> +comment "Consider upgrading to libgpiod2"
> + depends on BR2_PACKAGE_LIBGPIOD
> diff --git a/package/libgpiod2/libgpiod2.hash b/package/libgpiod2/libgpiod2.hash
> new file mode 100644
> index 0000000000..b5488496b2
> --- /dev/null
> +++ b/package/libgpiod2/libgpiod2.hash
> @@ -0,0 +1,4 @@
> +# From https://www.kernel.org/pub/software/libs/libgpiod/sha256sums.asc
> +sha256 fa4024a080121c958502f9a46a5bda44bea85e7a4dd7fcb3dead463b6fc4261c libgpiod-2.1.tar.xz
> +# Hash for license file
> +sha256 eb17a56966db5d986bec449ee44ed61f01f9e3fafa952e527db67a8f9594fd11 COPYING
> diff --git a/package/libgpiod2/libgpiod2.mk b/package/libgpiod2/libgpiod2.mk
> new file mode 100644
> index 0000000000..0749ec3cc4
> --- /dev/null
> +++ b/package/libgpiod2/libgpiod2.mk
> @@ -0,0 +1,41 @@
> +################################################################################
> +#
> +# libgpiod2
> +#
> +################################################################################
> +
> +# Be careful when bumping versions.
> +# Dependency on kernel header versions may change.
> +LIBGPIOD2_VERSION = 2.1
> +LIBGPIOD2_SOURCE = libgpiod-$(LIBGPIOD2_VERSION).tar.xz
> +LIBGPIOD2_SITE = https://www.kernel.org/pub/software/libs/libgpiod
> +LIBGPIOD2_LICENSE = LGPL-2.1+
> +LIBGPIOD2_LICENSE_FILES = COPYING
> +LIBGPIOD2_INSTALL_STAGING = YES
> +LIBGPIOD2_DEPENDENCIES = host-pkgconf host-autoconf-archive
> +LIBGPIOD2_CONF_OPTS = --disable-tests --disable-examples
> +
> +ifeq ($(BR2_PACKAGE_LIBGPIOD2_TOOLS),y)
> +LIBGPIOD2_CONF_OPTS += --enable-tools
> +else
> +LIBGPIOD2_CONF_OPTS += --disable-tools
> +endif
> +
> +ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
> +LIBGPIOD2_CONF_OPTS += --enable-bindings-cxx
> +else
> +LIBGPIOD2_CONF_OPTS += --disable-bindings-cxx
> +endif
> +
> +ifeq ($(BR2_PACKAGE_PYTHON3),y)
> +LIBGPIOD2_CONF_OPTS += --enable-bindings-python
The python bindings don't work for me here:
/home/marcus/repos/buildroot_tmp/recovery/per-package/libgpiod2/host/bin/python3
setup.py build_ext --inplace \
--include-dirs=../../include/:../../tests/gpiosim/ \
--library-dirs=../../lib/.libs/:../../tests/gpiosim/.libs/
Traceback (most recent call last):
File
"/home/marcus/repos/buildroot_tmp/recovery/build/libgpiod2-2.1/bindings/python/setup.py",
line 7, in <module>
from setuptools import Extension, find_packages, setup
ModuleNotFoundError: No module named 'setuptools'
So it needs at least a host-python-setuptools dependency. But then it
fails with:
creating build/lib.linux-x86_64-cpython-311
creating build/lib.linux-x86_64-cpython-311/gpiod
/home/marcus/repos/buildroot_tmp/recovery/per-package/libgpiod2/host/bin/ccache
/usr/bin/gcc -shared
-L/home/marcus/repos/buildroot_tmp/recovery/per-package/libgpiod2/host/lib
-Wl,-rpath,/home/marcus/repos/buildroot_tmp/recovery/per-package/libgpiod2/host/lib
-Wl,--enable-new-dtags
build/temp.linux-x86_64-cpython-311/gpiod/ext/chip.o
build/temp.linux-x86_64-cpython-311/gpiod/ext/common.o
build/temp.linux-x86_64-cpython-311/gpiod/ext/line-config.o
build/temp.linux-x86_64-cpython-311/gpiod/ext/line-settings.o
build/temp.linux-x86_64-cpython-311/gpiod/ext/module.o
build/temp.linux-x86_64-cpython-311/gpiod/ext/request.o
-L../../lib/.libs/ -L../../tests/gpiosim/.libs/
-L/home/marcus/repos/buildroot_tmp/recovery/per-package/libgpiod2/host/lib
-lgpiod -o
build/lib.linux-x86_64-cpython-311/gpiod/_ext.cpython-311-x86_64-linux-gnu.so
/usr/bin/ld: skipping incompatible ../../lib/.libs//libgpiod.so when
searching for -lgpiod
/usr/bin/ld: cannot find -lgpiod: No such file or directory
/usr/bin/ld: skipping incompatible ../../lib/.libs//libgpiod.so when
searching for -lgpiod
collect2: error: ld returned 1 exit status
error: command
'/home/marcus/repos/buildroot_tmp/recovery/per-package/libgpiod2/host/bin/ccache'
failed with exit code 1
Openembedded (where the package is maintained by the libgpiod
maintainer) switched to installing the python bindings as a "normal"
python package from pypi.org [1][2]
Note that there is https://pypi.org/project/libgpiod/ which was briefly
used as a package name for one single version but now
https://pypi.org/project/gpiod/ is used which previously (<2.0) was
hosting a completely different implementation of interfacing with
libgpiod from python... yeah, this isn't confusing at all, again :D.
Anyway, I had this:
PYTHON_LIBGPIOD_VERSION = 2.0.1
PYTHON_LIBGPIOD_SOURCE = libgpiod-$(PYTHON_LIBGPIOD_VERSION).tar.gz
PYTHON_LIBGPIOD_SITE = https://files.pythonhosted.org/packages/6d/e3
/7a3a102b1cc490c4ff19ab63a5d8a228b3b3effa1339cefe1e5bb04f9320
PYTHON_LIBGPIOD_SETUP_TYPE = setuptools
PYTHON_LIBGPIOD_DEPENDENCIES = libgpiod
$(eval $(python-package))
Which worked, but now it obviously should to be called PYTHON_GPIOD and
point to version 2.1(.3).
[1]
https://github.com/openembedded/meta-openembedded/commit/941b3bc262dd439eaf4bd6e0f2c7df8ed14c56cf
[2]
https://github.com/openembedded/meta-openembedded/commit/cd26db61af27a9f822492b1d67b0e39e6828e7cb
Best,
Marcus
More information about the buildroot
mailing list