Skip to contentSkip to conversation

Add python-libyang and python-sysrepo packages

PATCH In review Vincent Jardin via buildroot 2 participants 11 messages Jan 7 – Feb 18

lore
Share & tools
lore
#0 lore raw

cover Add python-libyang and python-sysrepo packages

This series adds Python bindings for libyang and sysrepo:

- python-libyang: Python CFFI bindings for the libyang YANG library, providing the 'libyang' Python module used by higher-level tooling.

- python-sysrepo: Python CFFI bindings for the sysrepo YANG datastore, providing the 'sysrepo' Python module. This patch also includes a fix for sysrepo build on riscv32.

Both packages include proper dependencies on Python3 with uClibc/kernel headers constraints (Python3 requires kernel headers >= 5.1 on uClibc).

CI build verification:
https://gitlab.com/vjardin/buildroot/-/pipelines/2249634938

Vincent Jardin (2):
package/python-libyang: new package
package/python-sysrepo: new package

 DEVELOPERS                                 |  2 ++
 package/Config.in                          |  2 ++
 package/python-libyang/Config.in           | 23 +++++++++++++++++++
 package/python-libyang/python-libyang.hash |  5 +++++
 package/python-libyang/python-libyang.mk   | 21 +++++++++++++++++
 package/python-sysrepo/Config.in           | 26 ++++++++++++++++++++++
 package/python-sysrepo/python-sysrepo.hash |  5 +++++
 package/python-sysrepo/python-sysrepo.mk   | 18 +++++++++++++++
 package/sysrepo/sysrepo.mk                 |  7 ++++++
 9 files changed, 109 insertions(+)
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 1/2 package/python-libyang: new package

Python CFFI bindings for the libyang YANG library. This package provides the 'libyang' Python module used by higher-level tooling such as python-sysrepo.

---
 DEVELOPERS                                 |  2 ++
 package/Config.in                          |  2 ++
 package/python-libyang/Config.in           | 23 ++++++++++++++++++++++
 package/python-libyang/python-libyang.hash |  5 +++++
 package/python-libyang/python-libyang.mk   | 21 ++++++++++++++++++++
 5 files changed, 53 insertions(+)
 create mode 100644 package/python-libyang/Config.in
 create mode 100644 package/python-libyang/python-libyang.hash
 create mode 100644 package/python-libyang/python-libyang.mk
DEVELOPERS +2 -0
index f982e3123a..5585e8b353 100644
@@ -3359,6 +3359,8 @@ F:	package/bfscripts/
 F:	package/dpdk/
 F:	package/libecoli/
 F:	package/libyang-cpp/
+F:	package/python-libyang/
+F:	package/python-sysrepo/
 F:	package/sysrepo-cpp/
 
 N:	Vincent Prince <[email protected]>
package/Config.in +2 -0
index def3db0e50..19d32c16ea 100644
@@ -1205,6 +1205,7 @@ menu "External python modules"
 	source "package/python-libconfig/Config.in"
 	source "package/python-libevdev/Config.in"
 	source "package/python-libusb1/Config.in"
+	source "package/python-libyang/Config.in"
 	source "package/python-lmdb/Config.in"
 	source "package/python-lockfile/Config.in"
 	source "package/python-log-rate-limit/Config.in"
@@ -1434,6 +1435,7 @@ menu "External python modules"
 	source "package/python-stack-data/Config.in"
 	source "package/python-starlette/Config.in"
 	source "package/python-sympy/Config.in"
+	source "package/python-sysrepo/Config.in"
 	source "package/python-systemd/Config.in"
 	source "package/python-tabledata/Config.in"
 	source "package/python-tcolorpy/Config.in"
package/python-libyang/Config.in new file +23 -0
new file mode 100644
index 0000000000..793bf7e3c5
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_PYTHON_LIBYANG
+	bool "python-libyang"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on BR2_PACKAGE_LIBYANG
+	# Python3 doesn't work with uClibc and kernel headers < 5.1
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
+	select BR2_PACKAGE_PYTHON_CFFI
+	help
+	  Python CFFI bindings for the libyang YANG library.
+
+	  This package provides the 'libyang' Python module, used by
+	  higher-level tooling such as python-sysrepo.
+
+	  https://github.com/CESNET/libyang-python
+
+comment "python-libyang needs python3, uClibc needs kernel headers >= 5.1"
+	depends on !BR2_PACKAGE_PYTHON3 || \
+		(BR2_TOOLCHAIN_USES_UCLIBC && !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1)
+
+comment "python-libyang needs libyang"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
+	depends on !BR2_PACKAGE_LIBYANG
package/python-libyang/python-libyang.hash new file +5 -0
new file mode 100644
index 0000000000..077d97cdd8
@@ -0,0 +1,5 @@
+# From https://pypi.org/pypi/libyang/3.3.0/json
+sha256  97da2c908a8a3607ac834f2acec224ea53a4b9e9770c13e5598513641decf637  libyang-3.3.0.tar.gz
+
+# Locally computed
+sha256  c8d554f918d32b1467f35829e1cfb753764dd683c6edcecc877a4d7e9f05b2a7  LICENSE
package/python-libyang/python-libyang.mk new file +21 -0
new file mode 100644
index 0000000000..2e4d1f3b90
@@ -0,0 +1,21 @@
+################################################################################
+#
+# python-libyang
+#
+################################################################################
+
+PYTHON_LIBYANG_VERSION = 3.3.0
+PYTHON_LIBYANG_SOURCE = libyang-$(PYTHON_LIBYANG_VERSION).tar.gz
+PYTHON_LIBYANG_SITE = https://files.pythonhosted.org/packages/source/l/libyang
+
+PYTHON_LIBYANG_LICENSE = MIT
+PYTHON_LIBYANG_LICENSE_FILES = LICENSE
+
+# pyproject.toml (PEP517)
+PYTHON_LIBYANG_SETUP_TYPE = pep517
+
+PYTHON_LIBYANG_DEPENDENCIES = \
+	libyang \
+	host-python-cffi
+
+$(eval $(python-package))
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH v1 1/2] package/python-libyang: new package

Hello Vincent,

DEVELOPERS F: package/bfscripts/ · line 3363

Quoted 10 lines · On Wed, 7 Jan 2026 18:54:45 +0100 Vincent Jardin via buildroot…
DEVELOPERS +2 -0
index f982e3123a..5585e8b353 100644
@@ -3359,6 +3359,8 @@ F:	package/bfscripts/
 F:	package/dpdk/
 F:	package/libecoli/
 F:	package/libyang-cpp/
+F:	package/python-libyang/
+F:	package/python-sysrepo/

There's a problem in the patch splitting here. This patch should only add the entry for python-libyang.

Quoted 16 lines
DEVELOPERS +0 -0
 F:	package/sysrepo-cpp/
 
 N:	Vincent Prince <[email protected]>
package/Config.in +1 -0
index def3db0e50..19d32c16ea 100644
@@ -1205,6 +1205,7 @@ menu "External python modules"
 	source "package/python-libconfig/Config.in"
 	source "package/python-libevdev/Config.in"
 	source "package/python-libusb1/Config.in"
+	source "package/python-libyang/Config.in"
 	source "package/python-lmdb/Config.in"
 	source "package/python-lockfile/Config.in"
 	source "package/python-log-rate-limit/Config.in"

package/Config.in menu "External python modules" · line 1441

Quoted 7 lines
package/Config.in +1 -0
@@ -1434,6 +1435,7 @@ menu "External python modules"
 	source "package/python-stack-data/Config.in"
 	source "package/python-starlette/Config.in"
 	source "package/python-sympy/Config.in"
+	source "package/python-sysrepo/Config.in"
 	source "package/python-systemd/Config.in"
 	source "package/python-tabledata/Config.in"
 	source "package/python-tcolorpy/Config.in"

Same comment here.

package/python-libyang/Config.in line 3

Quoted 9 lines
package/python-libyang/Config.in new file +3 -0
new file mode 100644
index 0000000000..793bf7e3c5
@@ -0,0 +1,23 @@
+config BR2_PACKAGE_PYTHON_LIBYANG
+	bool "python-libyang"
+	depends on BR2_PACKAGE_PYTHON3

Not needed, since all python-*/Config.in are already included inside a if BR2_PACKAGE_PYTHON3... endif condition.

package/python-libyang/Config.in line 4

Quoted 1 line
package/python-libyang/Config.in new file +1 -0
+	depends on BR2_PACKAGE_LIBYANG

This should be a "select", and then you replicate the "depends on" from BR2_PACKAGE_LIBYANG:

depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libyang depends on BR2_TOOLCHAIN_HAS_THREADS # libyang depends on !BR2_STATIC_LIBS # libyang

package/python-libyang/Config.in line 6

Quoted 2 lines
package/python-libyang/Config.in new file +2 -0
+	# Python3 doesn't work with uClibc and kernel headers < 5.1
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1

This is no longer the case, this issue has been fixed in Buildroot, so this dependency can be dropped.

package/python-libyang/Config.in line 7

Quoted 1 line
package/python-libyang/Config.in new file +1 -0
+	select BR2_PACKAGE_PYTHON_CFFI

select BR2_PACKAGE_PYTHON_CFFI # runtime

Quoted 6 lines
package/python-libyang/Config.in new file +6 -0
+	help
+	  Python CFFI bindings for the libyang YANG library.
+
+	  This package provides the 'libyang' Python module, used by
+	  higher-level tooling such as python-sysrepo.
+

package/python-libyang/Config.in line 23

Quoted 10 lines
package/python-libyang/Config.in new file +10 -0
+	  https://github.com/CESNET/libyang-python
+
+comment "python-libyang needs python3, uClibc needs kernel headers >= 5.1"
+	depends on !BR2_PACKAGE_PYTHON3 || \
+		(BR2_TOOLCHAIN_USES_UCLIBC && !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1)
+
+comment "python-libyang needs libyang"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
+	depends on !BR2_PACKAGE_LIBYANG

This needs to be updated to cover those dependencies:

depends on BR2_TOOLCHAIN_HAS_SYNC_4 # libyang depends on BR2_TOOLCHAIN_HAS_THREADS # libyang depends on !BR2_STATIC_LIBS # libyang

No need to mention the python3 dependency.

Rest looks good to me.

Thanks!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#3 lore raw

PATCH 2/2 package/python-sysrepo: new package

In reply to Vincent Jardin via buildroot

Python CFFI bindings for the sysrepo YANG datastore. This package provides the 'sysrepo' Python module which talks to the C sysrepo library.

Also fix sysrepo build on riscv32 where glibc doesn't define SYS_futex (only SYS_futex_time64). Use pthread-based condition variables instead of futex on this architecture.

Upstream: https://github.com/sysrepo/sysrepo/issues/3346

---
 package/python-sysrepo/Config.in           | 26 ++++++++++++++++++++++
 package/python-sysrepo/python-sysrepo.hash |  5 +++++
 package/python-sysrepo/python-sysrepo.mk   | 18 +++++++++++++++
 package/sysrepo/sysrepo.mk                 |  7 ++++++
 4 files changed, 56 insertions(+)
 create mode 100644 package/python-sysrepo/Config.in
 create mode 100644 package/python-sysrepo/python-sysrepo.hash
 create mode 100644 package/python-sysrepo/python-sysrepo.mk
package/python-sysrepo/Config.in new file +26 -0
new file mode 100644
index 0000000000..ce6b8611f2
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_PYTHON_SYSREPO
+	bool "python-sysrepo"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on BR2_PACKAGE_SYSREPO
+	# Python3 doesn't work with uClibc and kernel headers < 5.1
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
+	select BR2_PACKAGE_PYTHON_LIBYANG
+	help
+	  Python CFFI bindings for the sysrepo YANG datastore.
+
+	  This package provides the 'sysrepo' Python module which
+	  talks to the C sysrepo library packaged as
+	  BR2_PACKAGE_SYSREPO.
+
+	  Upstream project name on PyPI is 'sysrepo'.
+
+	  https://github.com/sysrepo/sysrepo-python
+
+comment "python-sysrepo needs python3, uClibc needs kernel headers >= 5.1"
+	depends on !BR2_PACKAGE_PYTHON3 || \
+		(BR2_TOOLCHAIN_USES_UCLIBC && !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1)
+
+comment "python-sysrepo needs sysrepo"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
+	depends on !BR2_PACKAGE_SYSREPO
package/python-sysrepo/python-sysrepo.hash new file +5 -0
new file mode 100644
index 0000000000..4b70cd12da
@@ -0,0 +1,5 @@
+# From https://pypi.org/pypi/sysrepo/1.7.6/json
+sha256  d257f20ed134c00676ef38ce858a4e16ca573214d9fbf03078383f0ef8d17641  sysrepo-1.7.6.tar.gz
+
+# Locally computed
+sha256  c47e5249d2dff016106bf7395df1d94c7c5d74a36d64b81d96637f1f25dff4da  LICENSE
package/python-sysrepo/python-sysrepo.mk new file +18 -0
new file mode 100644
index 0000000000..5e9e97df25
@@ -0,0 +1,18 @@
+################################################################################
+#
+# python-sysrepo
+#
+################################################################################
+
+PYTHON_SYSREPO_VERSION = 1.7.6
+PYTHON_SYSREPO_SOURCE = sysrepo-$(PYTHON_SYSREPO_VERSION).tar.gz
+PYTHON_SYSREPO_SITE = https://files.pythonhosted.org/packages/source/s/sysrepo
+PYTHON_SYSREPO_SETUP_TYPE = setuptools
+
+PYTHON_SYSREPO_LICENSE = BSD-3-Clause
+PYTHON_SYSREPO_LICENSE_FILES = LICENSE
+
+PYTHON_SYSREPO_DEPENDENCIES = sysrepo
+PYTHON_SYSREPO_DEPENDENCIES += python-libyang
+
+$(eval $(python-package))
package/sysrepo/sysrepo.mk +7 -0
index 59dc59a5df..329c0ee7c6 100644
@@ -26,6 +26,13 @@ ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
 SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
+# riscv32 glibc doesn't define SYS_futex (only SYS_futex_time64)
+# Use pthread-based condition variables instead of futex
+# https://github.com/sysrepo/sysrepo/issues/3346
+ifeq ($(BR2_RISCV_32),y)
+SYSREPO_CONF_OPTS += -DSR_COND_IMPL=sr_cond_pthread
+endif
+
 define SYSREPO_INSTALL_INIT_SYSV
 	$(INSTALL) -m 755 -D package/sysrepo/S51sysrepo-plugind \
 		$(TARGET_DIR)/etc/init.d/S51sysrepo-plugind
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

Re: [Buildroot] [PATCH v1 2/2] package/python-sysrepo: new package

Hello Vincent,

Thanks for the patch.

Quoted 12 lines · On Wed, 7 Jan 2026 18:54:46 +0100 Vincent Jardin via buildroot…

Python CFFI bindings for the sysrepo YANG datastore. This package provides the 'sysrepo' Python module which talks to the C sysrepo library.

Also fix sysrepo build on riscv32 where glibc doesn't define SYS_futex (only SYS_futex_time64). Use pthread-based condition variables instead of futex on this architecture.

Upstream: https://github.com/sysrepo/sysrepo/issues/3346

Quoted 7 lines
---
 package/python-sysrepo/Config.in           | 26 ++++++++++++++++++++++
 package/python-sysrepo/python-sysrepo.hash |  5 +++++
 package/python-sysrepo/python-sysrepo.mk   | 18 +++++++++++++++
 package/sysrepo/sysrepo.mk                 |  7 ++++++
 4 files changed, 56 insertions(+)

Missing changes in DEVELOPERS and package/Config.in (because they are mistakenly in PATCH 1/2).

package/python-sysrepo/Config.in line 3

Quoted 9 lines
package/python-sysrepo/Config.in new file +3 -0
new file mode 100644
index 0000000000..ce6b8611f2
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_PYTHON_SYSREPO
+	bool "python-sysrepo"
+	depends on BR2_PACKAGE_PYTHON3

Not needed.

package/python-sysrepo/Config.in line 4

Quoted 1 line
package/python-sysrepo/Config.in new file +1 -0
+	depends on BR2_PACKAGE_SYSREPO

Should be a "select" + replication of sysrepo "depends on".

package/python-sysrepo/Config.in line 6

Quoted 2 lines
package/python-sysrepo/Config.in new file +2 -0
+	# Python3 doesn't work with uClibc and kernel headers < 5.1
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1

Not needed.

package/python-sysrepo/Config.in line 7

Quoted 1 line
package/python-sysrepo/Config.in new file +1 -0
+	select BR2_PACKAGE_PYTHON_LIBYANG

select BR2_PACKAGE_PYTHON_LIBYANG # runtime

Quoted 4 lines
package/python-sysrepo/Config.in new file +4 -0
+	help
+	  Python CFFI bindings for the sysrepo YANG datastore.
+
+	  This package provides the 'sysrepo' Python module which

package/python-sysrepo/Config.in line 21

Quoted 10 lines
package/python-sysrepo/Config.in new file +10 -0
+	  talks to the C sysrepo library packaged as
+	  BR2_PACKAGE_SYSREPO.
+
+	  Upstream project name on PyPI is 'sysrepo'.
+
+	  https://github.com/sysrepo/sysrepo-python
+
+comment "python-sysrepo needs python3, uClibc needs kernel headers >= 5.1"
+	depends on !BR2_PACKAGE_PYTHON3 || \
+		(BR2_TOOLCHAIN_USES_UCLIBC && !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1)

To be updated based on the actual dependencies.

package/python-sysrepo/Config.in line 26

Quoted 4 lines
package/python-sysrepo/Config.in new file +4 -0
+comment "python-sysrepo needs sysrepo"
+	depends on BR2_PACKAGE_PYTHON3
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_1
+	depends on !BR2_PACKAGE_SYSREPO

Not needed.

Quoted 12 lines
package/python-sysrepo/python-sysrepo.mk new file +6 -0
new file mode 100644
index 0000000000..5e9e97df25
@@ -0,0 +1,18 @@
+################################################################################
+#
+# python-sysrepo
+#
+################################################################################
+

package/python-sysrepo/python-sysrepo.mk line 16

Quoted 10 lines
package/python-sysrepo/python-sysrepo.mk new file +10 -0
+PYTHON_SYSREPO_VERSION = 1.7.6
+PYTHON_SYSREPO_SOURCE = sysrepo-$(PYTHON_SYSREPO_VERSION).tar.gz
+PYTHON_SYSREPO_SITE = https://files.pythonhosted.org/packages/source/s/sysrepo
+PYTHON_SYSREPO_SETUP_TYPE = setuptools
+
+PYTHON_SYSREPO_LICENSE = BSD-3-Clause
+PYTHON_SYSREPO_LICENSE_FILES = LICENSE
+
+PYTHON_SYSREPO_DEPENDENCIES = sysrepo
+PYTHON_SYSREPO_DEPENDENCIES += python-libyang

Are you sure python-libyang is a build-time dependency, or is it only a runtime dependency?

Also, with Python packages, it's always good to have a minimal test case in support/testing/.

Quoted 5 lines
package/sysrepo/sysrepo.mk +0 -0
index 59dc59a5df..329c0ee7c6 100644

package/sysrepo/sysrepo.mk ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) · line 34

Quoted 9 lines
package/sysrepo/sysrepo.mk +6 -0
@@ -26,6 +26,13 @@ ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
 SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
+# riscv32 glibc doesn't define SYS_futex (only SYS_futex_time64)
+# Use pthread-based condition variables instead of futex
+# https://github.com/sysrepo/sysrepo/issues/3346
+ifeq ($(BR2_RISCV_32),y)
+SYSREPO_CONF_OPTS += -DSR_COND_IMPL=sr_cond_pthread
+endif

This is unrelated and should really be in its own patch. I guess it fixes:

https://autobuild.buildroot.net/results/b0f/b0f30feeddad1a8d51ac87af8b7c56fd9a9b5ff6/build-end.log

Correct?

If yes, then you should indicate in the patch that it fixes a build issue, have the link to the autobuilder failure, and indicate when the issue was introduced, so that we can understand if the fix should be backported to our 2025.02 LTS branch.

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

cover package/sysrepo: fix build on riscv32

This patch fixes sysrepo build on riscv32, where glibc doesn't define SYS_futex (only SYS_futex_time64), causing the build to fail.

The fix uses pthread-based condition variables instead of futex on this architecture by setting -DSR_COND_IMPL=sr_cond_pthread.

This issue affects all sysrepo versions on riscv32 glibc configurations, including the 2025.02 LTS branch (sysrepo 3.6.11), so this fix should be backported.

Fixes:
https://autobuild.buildroot.net/results/b0f/b0f30feeddad1a8d51ac87af8b7c56fd9a9b5ff6/build-end.log

Upstream: https://github.com/sysrepo/sysrepo/issues/3346

CI build verification:
https://gitlab.com/vjardin/buildroot/-/pipelines/2269971852

Vincent Jardin (1):
package/sysrepo: fix build on riscv32

 package/sysrepo/sysrepo.mk | 7 +++++++
 1 file changed, 7 insertions(+)

--
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#6 lore raw

PATCH 1/1 package/sysrepo: fix build on riscv32

On riscv32, glibc doesn't define SYS_futex (only SYS_futex_time64), causing the build to fail with:

error: 'SYS_futex' undeclared

Use pthread-based condition variables instead of futex on this architecture by setting -DSR_COND_IMPL=sr_cond_pthread.

Fixes:
https://autobuild.buildroot.net/results/b0f/b0f30feeddad1a8d51ac87af8b7c56fd9a9b5ff6/build-end.log

The issue affects all sysrepo versions on riscv32 glibc configurations. Since the 2025.02 LTS branch has sysrepo 3.6.11 which also has this issue, this fix should be backported.

Upstream: https://github.com/sysrepo/sysrepo/issues/3346

---
 package/sysrepo/sysrepo.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/sysrepo/sysrepo.mk +7 -0
index 59dc59a5df..329c0ee7c6 100644
@@ -26,6 +26,13 @@ ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
 SYSREPO_CONF_OPTS += -DCMAKE_EXE_LINKER_FLAGS=-latomic
 endif
 
+# riscv32 glibc doesn't define SYS_futex (only SYS_futex_time64)
+# Use pthread-based condition variables instead of futex
+# https://github.com/sysrepo/sysrepo/issues/3346
+ifeq ($(BR2_RISCV_32),y)
+SYSREPO_CONF_OPTS += -DSR_COND_IMPL=sr_cond_pthread
+endif
+
 define SYSREPO_INSTALL_INIT_SYSV
 	$(INSTALL) -m 755 -D package/sysrepo/S51sysrepo-plugind \
 		$(TARGET_DIR)/etc/init.d/S51sysrepo-plugind
Signature · 6 lines
2.43.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw

Re: [Buildroot] [PATCH v1 1/1] package/sysrepo: fix build on riscv32

Hello Vincent,

package/sysrepo/sysrepo.mk ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y) · line 34

Quoted 6 lines · Vincent Jardin
package/sysrepo/sysrepo.mk +6 -0
+# riscv32 glibc doesn't define SYS_futex (only SYS_futex_time64)
+# Use pthread-based condition variables instead of futex
+# https://github.com/sysrepo/sysrepo/issues/3346
+ifeq ($(BR2_RISCV_32),y)
+SYSREPO_CONF_OPTS += -DSR_COND_IMPL=sr_cond_pthread
+endif

Thanks for the fix. However, since sysrepo is maintained *and* using a reasonable build system (CMake), the build system should test the availability of SYS_futex, and only use it if available, without requiring the user to know about these "gory" details. After all, this is what CMakeLists.txt tests are made for. Could you cook something like this, or check with upstream?

Thanks a lot!

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw

PATCH v2 1/1 package/sysrepo: fix build on riscv32

In reply to Vincent Jardin via buildroot

Fixes:
https://autobuild.buildroot.net/results/b0f/b0f30feeddad1a8d51ac87af8b7c56fd9a9b5ff6/build-end.log

Upstream: https://github.com/sysrepo/sysrepo/commit/a0661b7e6a7b2f784fe3222048066c31187c6f92

---
v1 -> v2:
- Backport upstream patch.

Tested with Buildroot gitlab CI:
https://gitlab.com/v_cz/buildroot/-/pipelines/2331736795

 ...-sr_cond_futex-only-if-SYS_futex-sys.patch | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 package/sysrepo/0001-cmake-UPDATE-use-sr_cond_futex-only-if-SYS_futex-sys.patch
package/sysrepo/0001-cmake-UPDATE-use-sr_cond_futex-only-if-SYS_futex-sys.patch new file +33 -0
new file mode 100644
index 0000000000..d1d2eac758
@@ -0,0 +1,33 @@
+From 6917e00fb6c99a97dacdae7040e5c4c53752b10f Mon Sep 17 00:00:00 2001
+From: Vincent Cruz <[email protected]>
+Date: Tue, 17 Feb 2026 14:14:06 +0100
+Subject: [PATCH 1/1] cmake UPDATE use sr_cond_futex only if SYS_futex syscall
+ is available
+
+Some architectures (for ex. riscv32) may not support SYS_futex system
+call, even though linux/futex.h include file is present.
+
+Upstream: https://github.com/sysrepo/sysrepo/commit/a0661b7e6a7b2f784fe3222048066c31187c6f92
+
+Signed-off-by: Vincent Cruz <[email protected]>
+---
+ CMakeLists.txt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9b36de44..e1b39c8c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -163,7 +163,8 @@ set(NACM_SRMON_DATA_PERM "600" CACHE STRING "NACM modules ietf-netconf-acm and s
+ # sr_cond implementation
+ if(NOT SR_COND_IMPL)
+     check_include_file("linux/futex.h" HAS_FUTEX)
+-    if(HAS_FUTEX)
++    check_symbol_exists(SYS_futex "sys/syscall.h" HAS_SYS_FUTEX)
++    if(HAS_FUTEX AND HAS_SYS_FUTEX)
+         set(SR_COND_IMPL "sr_cond_futex")
+     else()
+         set(SR_COND_IMPL "sr_cond_pthread")
+-- 
+2.51.0
+
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#9 lore raw

Re: [Buildroot] [PATCH v2 1/1] package/sysrepo: fix build on riscv32

Hello,

I realized that I should have sent this patch as a new one and not as a reply to an existing thread.
I also forgot to include the package developers.

I will re-submit this patch.

Sorry for the inconvenience.
Vincent Cruz

-----Message original-----
De: Vincent <[email protected]>
à: buildroot <[email protected]>
Cc: Vincent <[email protected]>; Vincent <[email protected]> Envoyé: mardi 17 février 2026 17:03 CET
Sujet : [PATCH v2 1/1] package/sysrepo: fix build on riscv32

Fixes:
https://autobuild.buildroot.net/results/b0f/b0f30feeddad1a8d51ac87af8b7c56fd9a9b5ff6/build-end.log

Upstream: https://github.com/sysrepo/sysrepo/commit/a0661b7e6a7b2f784fe3222048066c31187c6f92

---
v1 -> v2:
- Backport upstream patch.

Tested with Buildroot gitlab CI:
https://gitlab.com/v_cz/buildroot/-/pipelines/2331736795

 ...-sr_cond_futex-only-if-SYS_futex-sys.patch | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 package/sysrepo/0001-cmake-UPDATE-use-sr_cond_futex-only-if-SYS_futex-sys.patch
package/sysrepo/0001-cmake-UPDATE-use-sr_cond_futex-only-if-SYS_futex-sys.patch new file +33 -0
new file mode 100644
index 0000000000..d1d2eac758
@@ -0,0 +1,33 @@
+From 6917e00fb6c99a97dacdae7040e5c4c53752b10f Mon Sep 17 00:00:00 2001
+From: Vincent Cruz <[email protected]>
+Date: Tue, 17 Feb 2026 14:14:06 +0100
+Subject: [PATCH 1/1] cmake UPDATE use sr_cond_futex only if SYS_futex syscall
+ is available
+
+Some architectures (for ex. riscv32) may not support SYS_futex system
+call, even though linux/futex.h include file is present.
+
+Upstream: https://github.com/sysrepo/sysrepo/commit/a0661b7e6a7b2f784fe3222048066c31187c6f92
+
+Signed-off-by: Vincent Cruz <[email protected]>
+---
+ CMakeLists.txt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9b36de44..e1b39c8c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -163,7 +163,8 @@ set(NACM_SRMON_DATA_PERM "600" CACHE STRING "NACM modules ietf-netconf-acm and s
+ # sr_cond implementation
+ if(NOT SR_COND_IMPL)
+     check_include_file("linux/futex.h" HAS_FUTEX)
+-    if(HAS_FUTEX)
++    check_symbol_exists(SYS_futex "sys/syscall.h" HAS_SYS_FUTEX)
++    if(HAS_FUTEX AND HAS_SYS_FUTEX)
+         set(SR_COND_IMPL "sr_cond_futex")
+     else()
+         set(SR_COND_IMPL "sr_cond_pthread")
+-- 
+2.51.0
+
Signature · 6 lines
2.51.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#10 lore raw

Re: [Buildroot] [PATCH v1 0/1] package/sysrepo: fix build on riscv32

In reply to Vincent Jardin via buildroot

Hello Vincent,

Quoted 9 lines · Vincent Jardin

This patch fixes sysrepo build on riscv32, where glibc doesn't define SYS_futex (only SYS_futex_time64), causing the build to fail.

The fix uses pthread-based condition variables instead of futex on this architecture by setting -DSR_COND_IMPL=sr_cond_pthread.

This issue affects all sysrepo versions on riscv32 glibc configurations, including the 2025.02 LTS branch (sysrepo 3.6.11), so this fix should be backported.

Just to save you some time: sending a cover letter for a series composed of a single patch is not necessary. A cover letter is only needed when the series grows beyond one patch *and* some introduction explanation is needed.

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot