[Buildroot] [PATCH 1/1] package/libmodbus: bump version to 3.2.0
Julien BOIBESSOT
julien.boibessot at armadeus.com
Mon Sep 7 21:33:35 UTC 2026
https://github.com/stephane/libmodbus/blob/v3.2.0/NEWS.md
libmodbus 3.2.0 adds termios2 support to allow custom baud rates (RTU),
but the TCGETS2/TCSETS2 ioctl constants are not exposed by musl through
<sys/ioctl.h>. Add a patch to include <asm/ioctls.h>, which defines
these constants on all Linux libc, fixing the build with musl.
Added tarball hash provided by upstream.
Bump requested by Buildroot's autobuilder.
Build tested with test-pkg (6 toolchains : uclibc, glibc, noMMU, musl, static, old glibc).
Signed-off-by: Julien BOIBESSOT <julien.boibessot at armadeus.com>
---
...-include-asm-ioctls.h-for-termios2-s.patch | 40 +++++++++++++++++++
package/libmodbus/libmodbus.hash | 4 +-
package/libmodbus/libmodbus.mk | 2 +-
3 files changed, 43 insertions(+), 3 deletions(-)
create mode 100644 package/libmodbus/0001-src-modbus-rtu-include-asm-ioctls.h-for-termios2-s.patch
diff --git a/package/libmodbus/0001-src-modbus-rtu-include-asm-ioctls.h-for-termios2-s.patch b/package/libmodbus/0001-src-modbus-rtu-include-asm-ioctls.h-for-termios2-s.patch
new file mode 100644
index 0000000000..21b4ecebbd
--- /dev/null
+++ b/package/libmodbus/0001-src-modbus-rtu-include-asm-ioctls.h-for-termios2-s.patch
@@ -0,0 +1,40 @@
+From 5f6af9e0e3d6adebc103a1f5a45a5b0d9c5a7e11 Mon Sep 17 00:00:00 2001
+From: Julien BOIBESSOT <julien.boibessot at armadeus.com>
+Date: Mon, 07 Sep 2026 18:54:00 +0200
+Subject: [PATCH] src/modbus-rtu: include <asm/ioctls.h> for termios2 support
+
+Since v3.2.0, libmodbus uses the Linux termios2 interface (TCGETS2,
+TCSETS2) to support custom baud rates. The configure check detects
+"struct termios2" via <asm/termbits.h>, but the TCGETS2/TCSETS2 ioctl
+constants are defined in <asm/ioctls.h>, which is not included by musl
+libc through <sys/ioctl.h>.
+
+This breaks the build on musl-based systems:
+
+ modbus-rtu.c: error: 'TCGETS2' undeclared (first use in this function)
+ modbus-rtu.c: error: 'TCSETS2' undeclared (first use in this function)
+
+Include <asm/ioctls.h> alongside <sys/ioctl.h> when HAVE_STRUCT_TERMIOS2
+is defined to expose the TC*2 ioctl constants on all Linux libc.
+
+Upstream: not yet
+
+Signed-off-by: Julien BOIBESSOT <julien.boibessot at armadeus.com>
+---
+ src/modbus-rtu.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/modbus-rtu.c b/src/modbus-rtu.c
+index 2a063fb1..d8414d2d 100644
+--- a/src/modbus-rtu.c
++++ b/src/modbus-rtu.c
+@@ -14,6 +14,7 @@
+ #endif
+ #if defined(HAVE_STRUCT_TERMIOS2)
+ #include <sys/ioctl.h>
++#include <asm/ioctls.h>
+ #endif
+ #include "modbus-private.h"
+ #include <assert.h>
+--
+2.43.0
diff --git a/package/libmodbus/libmodbus.hash b/package/libmodbus/libmodbus.hash
index ddca835f34..dc5674f308 100644
--- a/package/libmodbus/libmodbus.hash
+++ b/package/libmodbus/libmodbus.hash
@@ -1,4 +1,4 @@
-# From https://github.com/stephane/libmodbus/releases/tag/v3.1.12
-sha256 2f4d4191cd196c1fba131daec03b621db75129d8255c832fc66b259d9fc46e7b libmodbus-3.1.12.tar.gz
+# From https://github.com/stephane/libmodbus/releases/tag/v3.2.0
+sha256 72239f319b9b8483e3d393c5a60865d734fcff18a8abbb2486e389834a2f6ef1 libmodbus-3.2.0.tar.gz
# Locally computed
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LESSER
diff --git a/package/libmodbus/libmodbus.mk b/package/libmodbus/libmodbus.mk
index 5d20aef35c..36e32fe5d4 100644
--- a/package/libmodbus/libmodbus.mk
+++ b/package/libmodbus/libmodbus.mk
@@ -4,7 +4,7 @@
#
################################################################################
-LIBMODBUS_VERSION = 3.1.12
+LIBMODBUS_VERSION = 3.2.0
LIBMODBUS_SITE = https://github.com/stephane/libmodbus/releases/download/v$(LIBMODBUS_VERSION)
LIBMODBUS_LICENSE = LGPL-2.1+
LIBMODBUS_LICENSE_FILES = COPYING.LESSER
--
2.43.0
More information about the buildroot
mailing list