All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
	Fabrice Fontaine <fontaine.fabrice@gmail.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/1] package/s6-dns: fix uclibc build
Date: Thu, 25 Jul 2024 17:53:48 +0200	[thread overview]
Message-ID: <20240725175348.551ed37e@windsurf> (raw)
In-Reply-To: <20240725132641.333219-1-dario.binacchi@amarulasolutions.com>

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

  reply	other threads:[~2024-07-25 15:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-07-25 15:59   ` Thomas Petazzoni via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240725175348.551ed37e@windsurf \
    --to=buildroot@buildroot.org \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=fontaine.fabrice@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.