Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/s6-dns: fix uclibc build
@ 2024-07-25 13:26 Dario Binacchi
  2024-07-25 15:53 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Dario Binacchi @ 2024-07-25 13:26 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Dario Binacchi

Fix the following build failure:

src/libs6dns/s6dns_hosts_init.c: In function 's6dns_hosts_init':
src/libs6dns/s6dns_hosts_init.c:34:27: error: 'struct stat' has no member named 'st_mtim'; did you mean 'st_mtime'?
   34 |     if (timespec_cmp(&stc.st_mtim, &str.st_mtim) > 0) goto useit ;
      |                           ^~~~~~~
      |                           st_mtime
src/libs6dns/s6dns_hosts_init.c:34:41: error: 'struct stat' has no member named 'st_mtim'; did you mean 'st_mtime'?
   34 |     if (timespec_cmp(&stc.st_mtim, &str.st_mtim) > 0) goto useit ;
      |                                         ^~~~~~~
      |                                         st_mtime

Fixes:
 - http://autobuild.buildroot.org/results/f97634e33c4ed94d6ab382a7c266288d814cfa0b

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
 package/s6-dns/s6-dns.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/s6-dns/s6-dns.mk b/package/s6-dns/s6-dns.mk
index 8e175431a4b9..ecd7764add35 100644
--- a/package/s6-dns/s6-dns.mk
+++ b/package/s6-dns/s6-dns.mk
@@ -12,6 +12,7 @@ S6_DNS_INSTALL_STAGING = YES
 S6_DNS_DEPENDENCIES = skalibs
 
 S6_DNS_CONF_OPTS = \
+	CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" \
 	--prefix=/ \
 	--with-sysdeps=$(STAGING_DIR)/lib/skalibs/sysdeps \
 	--with-include=$(STAGING_DIR)/include \
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/s6-dns: fix uclibc build
  2024-07-25 13:26 [Buildroot] [PATCH 1/1] package/s6-dns: fix uclibc build Dario Binacchi
@ 2024-07-25 15:53 ` Thomas Petazzoni via buildroot
  2024-07-25 15:59   ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-25 15:53 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: Eric Le Bihan, Fabrice Fontaine, buildroot

Hello Dario,

+Fabrice in Cc.

On Thu, 25 Jul 2024 15:26:41 +0200
Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> diff --git a/package/s6-dns/s6-dns.mk b/package/s6-dns/s6-dns.mk
> index 8e175431a4b9..ecd7764add35 100644
> --- a/package/s6-dns/s6-dns.mk
> +++ b/package/s6-dns/s6-dns.mk
> @@ -12,6 +12,7 @@ S6_DNS_INSTALL_STAGING = YES
>  S6_DNS_DEPENDENCIES = skalibs
>  
>  S6_DNS_CONF_OPTS = \
> +	CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" \

Fabrice suggested a similar fix for the tipidee package
in https://patchwork.ozlabs.org/project/buildroot/patch/20240724115554.2270864-1-fontaine.fabrice@gmail.com/.

And (as usual?), I am wondering if this is the correct fix.

man 3 stat tells us:

           /* Since POSIX.1-2008, this structure supports nanosecond
              precision for the following timestamp fields.
              For the details before POSIX.1-2008, see VERSIONS. */

           struct timespec  st_atim;  /* Time of last access */
           struct timespec  st_mtim;  /* Time of last modification */
           struct timespec  st_ctim;  /* Time of last status change */

       #define st_atime  st_atim.tv_sec  /* Backward compatibility */
       #define st_mtime  st_mtim.tv_sec
       #define st_ctime  st_ctim.tv_sec

   Feature    Test    Macro    Requirements   for   glibc   (see   fea‐
   ture_test_macros(7)):

       st_atim, st_mtim, st_ctim:
           Since glibc 2.12:
               _POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700
           glibc 2.19 and earlier:
               _BSD_SOURCE || _SVID_SOURCE

So it looks like _GNU_SOURCE is probably not the most accurate thing to
use. Also, why aren't glibc builds affected? The fields are also inside
a conditional in the stat.h from glibc:

# ifdef __USE_XOPEN2K8
    /* Nanosecond resolution timestamps are stored in a format
       equivalent to 'struct timespec'.  This is the type used
       whenever possible but the Unix namespace rules do not allow the
       identifier 'timespec' to appear in the <sys/stat.h> header.
       Therefore we have to handle the use of this header in strictly
       standard-compliant sources special.  */
    struct timespec st_atim;            /* Time of last access.  */
    struct timespec st_mtim;            /* Time of last modification.  */
    struct timespec st_ctim;            /* Time of last status change.  */
#  define st_atime st_atim.tv_sec       /* Backward compatibility.  */
#  define st_mtime st_mtim.tv_sec
#  define st_ctime st_ctim.tv_sec

In any case, it should be the package source code/build system's
responsibility to pass those flags properly. Passing them in Buildroot
is really a work-around.

I believe the C files using st_mtim should #define one of those feature
macros before including any of the header files.

Could you have a look into this? And same Fabrice for tipidee?

Thomas

-- 
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] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/s6-dns: fix uclibc build
  2024-07-25 15:53 ` Thomas Petazzoni via buildroot
@ 2024-07-25 15:59   ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-25 15:59 UTC (permalink / raw)
  To: Dario Binacchi; +Cc: Eric Le Bihan, Fabrice Fontaine, buildroot

Hello Dario,

On Thu, 25 Jul 2024 17:53:48 +0200
Thomas Petazzoni <thomas.petazzoni@bootlin.com> wrote:

> In any case, it should be the package source code/build system's
> responsibility to pass those flags properly. Passing them in Buildroot
> is really a work-around.
> 
> I believe the C files using st_mtim should #define one of those feature
> macros before including any of the header files.

Also, to add to the complexity, s6-dns relies on skalibs, which has its
own stat.h header file which does this:

#ifndef SKALIBS_STAT_H
#define SKALIBS_STAT_H

 /*
    This header must always be paired with skalibs/bsdsnowflake.h
    (which must always come first).
    If you #include <sys/stat.h> before bsdsnowflake, the
    workaround will not work.
 */

#include <skalibs/sysdeps.h>

#include <sys/stat.h>

#if !defined(SKALIBS_HASSTATIM) && defined(SKALIBS_HASSTATIMESPEC)

#define st_atim st_atimespec
#define st_mtim st_mtimespec
#define st_ctim st_ctimespec

#endif

#endif

I guess the easiest is probably to report the bug to upstream s6-dns
developers and see what they say.

Thomas
-- 
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] 3+ messages in thread

end of thread, other threads:[~2024-07-25 15:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-25 13:26 [Buildroot] [PATCH 1/1] package/s6-dns: fix uclibc build Dario Binacchi
2024-07-25 15:53 ` Thomas Petazzoni via buildroot
2024-07-25 15:59   ` 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