Hi,

I am trying to update coreutils to 9.11, but compilation fails.
In commit 161cdbbffbeedb8ada5992b0630056103db0d48b and 
b675dc5298457db0f4cc5b280a9c23f38d31a9c9 glibc specific optimization
where added. This code does not cross-compile for uClibc-ng based
systems, because of glibc specific data structure usage.

Attached is a patch which allows me to build coreutils again.

Would be nice if something like that could be integrated.

If more information is required please don't hesitate to ask.

thanks,
 best regards
  Waldemar
>From d5f512626b772bb9e3bb26e25b546b438cd7c605 Mon Sep 17 00:00:00 2001
From: Waldemar Brodkorb <[email protected]>
Date: Mon, 25 May 2026 20:37:32 +0200
Subject: [PATCH] fix uClibc-ng build of f.e. coreutils 9.11 upwards

Signed-off-by: Waldemar Brodkorb <[email protected]>
---
 lib/mbrtoc32.c | 2 +-
 lib/mbrtowc.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/mbrtoc32.c b/lib/mbrtoc32.c
index 7d691b8b2f..204128dbe2 100644
--- a/lib/mbrtoc32.c
+++ b/lib/mbrtoc32.c
@@ -142,7 +142,7 @@ mbrtoc32 (char32_t *pwc, const char *s, size_t n, mbstate_t *ps)
   if (ps == NULL)
     ps = &internal_state;
 
-# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2)
+# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2 && !__UCLIBC__)
   /* Optimize the frequent case of an UTF-8 locale.
      Since here we are in the !GNULIB_defined_mbstate_t case, i.e. we use
      the system's mbstate_t type and have to provide interoperability with
diff --git a/lib/mbrtowc.c b/lib/mbrtowc.c
index 59320cd51c..dfe51e8f15 100644
--- a/lib/mbrtowc.c
+++ b/lib/mbrtowc.c
@@ -124,7 +124,7 @@ rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
     return (size_t) -2;
 # endif
 
-# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2)
+# if (GNULIB_WCHAR_SINGLE_LOCALE && __GLIBC__ >= 2 && !__UCLIBC__)
   /* Optimize the frequent case of an UTF-8 locale.
      Since here we are in the !GNULIB_defined_mbstate_t case, i.e. we use
      the system's mbstate_t type and have to provide interoperability with
-- 
2.47.3

Reply via email to