From c5f5965bc41871300577ec24e3fabac9aff887e5 Mon Sep 17 00:00:00 2001 From: SuperSix173 Date: Sat, 25 Nov 2023 11:38:06 +0800 Subject: [PATCH] Fix errors when compile with musl Signed-off-by: SuperSix173 --- ...rt-Fix-errors-when-compile-with-musl.patch | 56 +++++++++++++++++++ procps-ng.spec | 6 +- 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 backport-Fix-errors-when-compile-with-musl.patch diff --git a/backport-Fix-errors-when-compile-with-musl.patch b/backport-Fix-errors-when-compile-with-musl.patch new file mode 100644 index 0000000..eefcf7d --- /dev/null +++ b/backport-Fix-errors-when-compile-with-musl.patch @@ -0,0 +1,56 @@ +From 0edb44333bb49763c265967a6e12cf590bde0d73 Mon Sep 17 00:00:00 2001 +From: Chao Liu +Date: Tue, 15 Aug 2023 03:37:19 +0000 +Subject: [PATCH] Fix errors when compile with musl + +__UT_NAMESIZE is undeclared in musl, which cause: + +ocps/4.0.2-r0/recipe-sysroot-native= -c -o src/w.o ../procps-ng-4.0.2/src/w.c +| ../procps-ng-4.0.2/src/w.c: In function 'print_from': +| ../procps-ng-4.0.2/src/w.c:70:22: error: '__UT_HOSTSIZE' undeclared (first use in this function); did you mean 'UT_HOSTSIZE'? +| 70 | # define UT_HOSTSIZE __UT_HOSTSIZE +| | ^~~~~~~~~~~~~ +| ../procps-ng-4.0.2/src/w.c:230:43: note: in expansion of macro 'UT_HOSTSIZE' +| 230 | print_display_or_interface(u->ut_host, UT_HOSTSIZE, fromlen - len); +| | ^~~~~~~~~~~ +| ../procps-ng-4.0.2/src/w.c:70:22: note: each undeclared identifier is reported only once for each function it appears in +| 70 | # define UT_HOSTSIZE __UT_HOSTSIZE +| | ^~~~~~~~~~~~~ +| ../procps-ng-4.0.2/src/w.c:230:43: note: in expansion of macro 'UT_HOSTSIZE' +| 230 | print_display_or_interface(u->ut_host, UT_HOSTSIZE, fromlen - len); +| | ^~~~~~~~~~~ +| ../procps-ng-4.0.2/src/w.c: In function 'find_best_proc': +| ../procps-ng-4.0.2/src/w.c:72:22: error: '__UT_NAMESIZE' undeclared (first use in this function); did you mean 'UT_NAMESIZE'? +| 72 | # define UT_NAMESIZE __UT_NAMESIZE +| | ^~~~~~~~~~~~~ +| ../procps-ng-4.0.2/src/w.c:391:18: note: in expansion of macro 'UT_NAMESIZE' +| 391 | char buf[UT_NAMESIZE + 1]; +| | ^~~~~~~~~~~ +| ../procps-ng-4.0.2/src/w.c: In function 'showinfo': +| ../procps-ng-4.0.2/src/w.c:72:22: error: '__UT_NAMESIZE' undeclared (first use in this function); did you mean 'UT_NAMESIZE'? +| 72 | # define UT_NAMESIZE __UT_NAMESIZE +--- + src/w.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/w.c b/src/w.c +index 2a1163ec..fd6e75f7 100644 +--- a/src/w.c ++++ b/src/w.c +@@ -78,11 +78,13 @@ typedef struct utmpx utmp_t; + typedef struct utmp utmp_t; + #endif + ++#ifdef __GLIBC__ + #if !defined(UT_HOSTSIZE) || defined(__UT_HOSTSIZE) + # define UT_HOSTSIZE __UT_HOSTSIZE + # define UT_LINESIZE __UT_LINESIZE + # define UT_NAMESIZE __UT_NAMESIZE + #endif ++#endif + + #ifdef W_SHOWFROM + # define FROM_STRING "on" +-- +GitLab + diff --git a/procps-ng.spec b/procps-ng.spec index 1919656..4d7ff6e 100644 --- a/procps-ng.spec +++ b/procps-ng.spec @@ -1,6 +1,6 @@ Name: procps-ng Version: 4.0.4 -Release: 1 +Release: 2 Summary: Utilities that provide system information. License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ URL: https://sourceforge.net/projects/procps-ng/ @@ -11,6 +11,7 @@ Source2: README.top Patch1: openeuler-add-M-and-N-options-for-top.patch Patch2: openeuler-top-exit-with-error-when-pid-overflow.patch +Patch3: backport-Fix-errors-when-compile-with-musl.patch BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel @@ -93,6 +94,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof %{_mandir}/man* %changelog +* Sat Nov 25 2023 Liu Chao - 4.0.4-2 +- Fix errors when compile with musl + * Wed Nov 01 2023 liweigang - 4.0.4-1 - update to version v4.0.4 -- Gitee