Richard: Thanks for your feedback and sorry for the late response on this. In fact, It is possible to define both _BSD_SOURCE and _DEFAULT_SOURCE simultaneously.
To define _BSD_SOURCE is mainly to avoid issues on older systems that do not recognize _DEFAULT_SOURCE. On other newer distros, the effect is the same as defining _DEFAULT_SOURCE alone. we verified on centos7 - ubuntu2004_64 - ubuntu2004_64_dash - opensuse153-64 - ubuntu2204_64 by automation. And I have verified on ubuntu2204_64 - ubuntu2404_64 - fedora41-64 by manual, that works well. Cheers, Guocai ________________________________ From: Richard Purdie <richard.pur...@linuxfoundation.org> Sent: Monday, January 6, 2025 6:22 PM To: He, Guocai (CN) <guocai.he...@windriver.com>; openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org> Subject: Re: [OE-core] [meta][kirkstone][PATCH] pseudo: Fix compile error on centos7 CAUTION: This email comes from a non Wind River email account! Do not click links or open attachments unless you recognize the sender and know the content is safe. On Thu, 2025-01-02 at 13:44 +0800, guocai he via lists.openembedded.org wrote: > From: Guocai He <guocai.he...@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...@windriver.com> > --- > meta/recipes-devtools/pseudo/files/glibc238.patch | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > 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 Whilst this may fix centos 7 I suspect it may break other newer distros :( Cheers, Richard
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#209701): https://lists.openembedded.org/g/openembedded-core/message/209701 Mute This Topic: https://lists.openembedded.org/mt/110385112/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-