* [Buildroot] [PATCH v2] package/util-linux: fix build with old glibc
@ 2023-10-09 13:11 Norbert Lange
2026-10-10 20:17 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Norbert Lange @ 2023-10-09 13:11 UTC (permalink / raw)
To: buildroot, peter; +Cc: Norbert Lange
The build still fails if newer kernel versions are mixed with older
glibc versions (Kernel 6.1 and glibc 2.28 for example).
Apply upstream fix [1], see bug report [2].
[1] - https://github.com/schubi2/util-linux/commit/8d67fc4e66816791aaadf0b03940b96c6dc3d92c
[2] - https://github.com/util-linux/util-linux/issues/2448
Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
Still cant build util-linux, neither on master nor on 2023.08.x
v1->v2:
* rebase using the commit in upstream master
Signed-off-by: Norbert Lange <nolange79@gmail.com>
---
.../0001-libmount-fix-statx-includes.patch | 127 ++++++++++++++++++
.../0001-libmount-fix-statx-includes.patch | 1 +
package/util-linux/util-linux.mk | 2 +-
3 files changed, 129 insertions(+), 1 deletion(-)
create mode 100644 package/util-linux/0001-libmount-fix-statx-includes.patch
create mode 120000 package/util-linux/util-linux-libs/0001-libmount-fix-statx-includes.patch
diff --git a/package/util-linux/0001-libmount-fix-statx-includes.patch b/package/util-linux/0001-libmount-fix-statx-includes.patch
new file mode 100644
index 0000000000..60cde1a63e
--- /dev/null
+++ b/package/util-linux/0001-libmount-fix-statx-includes.patch
@@ -0,0 +1,127 @@
+From 8d67fc4e66816791aaadf0b03940b96c6dc3d92c Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak@redhat.com>
+Date: Wed, 23 Aug 2023 11:50:37 +0200
+Subject: [PATCH] libmount: fix statx() includes
+
+Using sys/stat.h and linux/stat is too tricky.h together. It seems
+better to rely on libc and use sys/stat.h only. Users affected
+by old libc must update to use recent util-linux.
+
+Fixes: https://github.com/util-linux/util-linux/issues/2448
+Signed-off-by: Karel Zak <kzak@redhat.com>
+Signed-off-by: Norbert Lange <nolange79@gmail.com>
+---
+ configure.ac | 5 ++---
+ include/fileutils.h | 4 ++--
+ libmount/src/hook_mount.c | 2 +-
+ libmount/src/utils.c | 2 +-
+ meson.build | 5 ++---
+ 5 files changed, 8 insertions(+), 10 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 27c379a78be..aa4b3bc1c64 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -333,7 +333,6 @@ AC_CHECK_HEADERS([ \
+ linux/nsfs.h \
+ linux/pr.h \
+ linux/raw.h \
+- linux/stat.h \
+ linux/securebits.h \
+ linux/tiocl.h \
+ linux/version.h \
+@@ -527,7 +526,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+ ])
+
+ AC_CHECK_TYPES([struct mount_attr], [], [], [[#include <linux/mount.h>]])
+-AC_CHECK_TYPES([struct statx], [], [], [[#include <linux/stat.h>]])
+ AC_CHECK_TYPES([enum fsconfig_command], [], [], [[#include <linux/mount.h>]])
+
+ AC_CHECK_MEMBERS([struct termios.c_line],,,
+@@ -536,8 +534,9 @@ AC_CHECK_MEMBERS([struct termios.c_line],,,
+ AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,,
+ [[#include <sys/stat.h>]])
+
++AC_CHECK_TYPES([struct statx], [], [], [[#include <sys/stat.h>]])
+ AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,,
+- [[#include <linux/stat.h>]])
++ [[#include <sys/stat.h>]])
+
+ AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include <langinfo.h>]])
+
+diff --git a/include/fileutils.h b/include/fileutils.h
+index a5fe517266f..538eab0b74e 100644
+--- a/include/fileutils.h
++++ b/include/fileutils.h
+@@ -94,13 +94,13 @@ static inline int close_range(unsigned int first, unsigned int last, int flags)
+ # define HAVE_CLOSE_RANGE 1
+ # endif /* SYS_close_range */
+
+-# if !defined(HAVE_STATX) && defined(HAVE_STRUCT_STATX) && defined(SYS_statx) && defined(HAVE_LINUX_STAT_H)
+-# include <linux/stat.h>
++# if !defined(HAVE_STATX) && defined(HAVE_STRUCT_STATX) && defined(SYS_statx)
+ static inline int statx(int fd, const char *restrict path, int flags,
+ unsigned int mask, struct statx *stx)
+ {
+ return syscall(SYS_statx, fd, path, flags, mask, stx);
+ }
++# define HAVE_STATX 1
+ # endif /* SYS_statx */
+
+ #endif /* HAVE_SYS_SYSCALL_H */
+diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c
+index 056338c4914..0ebb8299853 100644
+--- a/libmount/src/hook_mount.c
++++ b/libmount/src/hook_mount.c
+@@ -294,7 +294,7 @@ static int hook_create_mount(struct libmnt_context *cxt,
+ /* cleanup after fail (libmount may only try the FS type) */
+ close_sysapi_fds(api);
+
+-#if defined(HAVE_STRUCT_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID)
++#if defined(HAVE_STATX) && defined(HAVE_STRUCT_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID)
+ if (!rc && cxt->fs) {
+ struct statx st;
+
+diff --git a/libmount/src/utils.c b/libmount/src/utils.c
+index 1d3f4abcece..3817b392711 100644
+--- a/libmount/src/utils.c
++++ b/libmount/src/utils.c
+@@ -111,7 +111,7 @@ static int safe_stat(const char *target, struct stat *st, int nofollow)
+
+ memset(st, 0, sizeof(struct stat));
+
+-#if defined(AT_STATX_DONT_SYNC) && defined (HAVE_STRUCT_STATX)
++#if defined(HAVE_STATX) && defined(HAVE_STRUCT_STATX) && defined(AT_STATX_DONT_SYNC)
+ {
+ int rc;
+ struct statx stx = { 0 };
+diff --git a/meson.build b/meson.build
+index 9a36c9157cc..d412ff38203 100644
+--- a/meson.build
++++ b/meson.build
+@@ -84,7 +84,7 @@ have_mountfd_api = cc.sizeof('struct mount_attr', prefix : '#include <linux/moun
+ conf.set('HAVE_STRUCT_MOUNT_ATTR', have_mountfd_api ? 1 : false)
+ conf.set('HAVE_MOUNTFD_API', have_mountfd_api ? 1 : false)
+
+-have_struct_statx = cc.sizeof('struct statx', prefix : '#include <linux/stat.h>') > 0
++have_struct_statx = cc.sizeof('struct statx', prefix : '#include <sys/stat.h>') > 0
+ conf.set('HAVE_STRUCT_STATX', have_struct_statx ? 1 : false)
+
+ build_libmount = not get_option('build-libmount').disabled()
+@@ -182,7 +182,6 @@ headers = '''
+ linux/nsfs.h
+ linux/mount.h
+ linux/pr.h
+- linux/stat.h
+ linux/securebits.h
+ linux/tiocl.h
+ linux/version.h
+@@ -645,7 +644,7 @@ have = cc.has_member('struct stat', 'st_mtim.tv_nsec',
+ conf.set('HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC', have ? 1 : false)
+
+ have = cc.has_member('struct statx', 'stx_mnt_id',
+- prefix : '#include <linux/stat.h>')
++ prefix : '#include <sys/stat.h>')
+ conf.set('HAVE_STRUCT_STATX_STX_MNT_ID', have ? 1 : false)
+
+ # replacement for AC_STRUCT_TIMEZONE
diff --git a/package/util-linux/util-linux-libs/0001-libmount-fix-statx-includes.patch b/package/util-linux/util-linux-libs/0001-libmount-fix-statx-includes.patch
new file mode 120000
index 0000000000..bc21ebedb7
--- /dev/null
+++ b/package/util-linux/util-linux-libs/0001-libmount-fix-statx-includes.patch
@@ -0,0 +1 @@
+../0001-libmount-fix-statx-includes.patch
\ No newline at end of file
diff --git a/package/util-linux/util-linux.mk b/package/util-linux/util-linux.mk
index ed9512c33c..fbfe579364 100644
--- a/package/util-linux/util-linux.mk
+++ b/package/util-linux/util-linux.mk
@@ -31,7 +31,7 @@ UTIL_LINUX_LICENSE_FILES = README.licensing \
UTIL_LINUX_CPE_ID_VENDOR = kernel
-# 0001-libmount-ifdef-statx-call.patch
+# 0001-libmount-fix-statx-includes.patch
UTIL_LINUX_AUTORECONF = YES
UTIL_LINUX_INSTALL_STAGING = YES
--
2.39.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH v2] package/util-linux: fix build with old glibc
2023-10-09 13:11 [Buildroot] [PATCH v2] package/util-linux: fix build with old glibc Norbert Lange
@ 2026-10-10 20:17 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-10-10 20:17 UTC (permalink / raw)
To: Norbert Lange; +Cc: buildroot
On Mon, Oct 09, 2023 at 03:11:20PM +0200, Norbert Lange wrote:
> The build still fails if newer kernel versions are mixed with older
> glibc versions (Kernel 6.1 and glibc 2.28 for example).
>
> Apply upstream fix [1], see bug report [2].
>
> [1] - https://github.com/schubi2/util-linux/commit/8d67fc4e66816791aaadf0b03940b96c6dc3d92c
> [2] - https://github.com/util-linux/util-linux/issues/2448
>
> Signed-off-by: Norbert Lange <nolange79@gmail.com>
Sorry for the very long delay. In the mean time, the patch you were
backporting was merged in util-linux 2.40, and we are using 2.40 in
2015.02.x and 2.41 in current master. Therefore I've marked your patch
as Not Applicable in patchwork.
Thanks a lot!
Thomas Petazzoni
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-10 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09 13:11 [Buildroot] [PATCH v2] package/util-linux: fix build with old glibc Norbert Lange
2026-10-10 20:17 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox