diff mbox series

[meta,kirkstone] pseudo: Fix compile error on centos7

Message ID 20250102054451.500564-1-guocai.he.cn@windriver.com
State Under Review
Delegated to: Steve Sakoman
Headers show
Series [meta,kirkstone] pseudo: Fix compile error on centos7 | expand

Commit Message

guocai he Jan. 2, 2025, 5:44 a.m. UTC
From: Guocai He <guocai.he.cn@windriver.com>

When host is centos7, fix the following build errors:

In file included from pseudolog.c:21:
/usr/include/sys/stat.h:366:31: error: array type has incomlete element type

In file included from pseudolog.c:21:
/usr/include/sys/stat.h:366:31: error: array type has incomplete element type "struct timespec"
  366 |         const struct timespec __times[2],
      |                               ^~~~~~~
pseudolog.c: In function "parse_file_type":
pseudolog.c:214:10: error: "S_IFSOCK" undeclared (first use in this function)
  214 |   return S_IFSOCK;
      |          ^~~~~~~~
pseudolog.c: In function "format_one":
pseudolog.c:754:43: error: "ALLPERM"  undeclared (first use in this function)
  754 |   printf(fmtbuf, (unsigned int) e->mode & ALLPERMS);
      |                                           ^~~~~~~~

upstream commit:
https://git.yoctoproject.org/pseudo/commit/?id=15b4f4ca25593f684e6517d0b809605b443d1953
When the host is older system,such as centos7, this upstream commit will introduce 
the build errors. To add "#define _BSD_SOURCE" is mainly to avoid issues on older 
systems that do not recognize _DEFAULT_SOURCE.

Signed-off-by: Guocai He <guocai.he.cn@windriver.com>
---
 meta/recipes-devtools/pseudo/files/glibc238.patch | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/meta/recipes-devtools/pseudo/files/glibc238.patch b/meta/recipes-devtools/pseudo/files/glibc238.patch
index dfb5c283f6..9a7cd3744d 100644
--- a/meta/recipes-devtools/pseudo/files/glibc238.patch
+++ b/meta/recipes-devtools/pseudo/files/glibc238.patch
@@ -28,6 +28,20 @@  Index: git/pseudo_wrappers.c
  #include <assert.h>
  #include <stdlib.h>
  #include <limits.h>
+Index: git/pseudolog.c
+===================================================================
+--- git.orig/pseudolog.c
++++ git/pseudolog.c
+@@ -10,6 +10,9 @@
+  * we then don't get S_IFSOCK... _GNU_SOURCE turns on everything. */
+ #define _DEFAULT_SOURCE
+ #define _XOPEN_SOURCE
++/* This is mainly to avoid issues on older systems that do not
++ * recognize _DEFAULT_SOURCE. */
++#define _BSD_SOURCE
+
+ #include <ctype.h>
+ #include <limits.h>
 Index: git/pseudo_util.c
 ===================================================================
 --- git.orig/pseudo_util.c