All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/zstd: pass _GNU_SOURCE in CFLAGS
@ 2022-06-12 20:09 Fabrice Fontaine
  2022-06-14 19:12 ` Arnout Vandecappelle via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Fontaine @ 2022-06-12 20:09 UTC (permalink / raw)
  To: buildroot; +Cc: Andrey Smirnov, Fabrice Fontaine

Fix the following build failure:

util.c: In function 'UTIL_utime':
util.c:173:27: error: 'stat_t' {aka 'const struct stat'} has no member named 'st_mtim'; did you mean 'st_mtime'?
  173 |     timebuf[1] = statbuf->st_mtim;
      |                           ^~~~~~~
      |                           st_mtime

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

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 package/zstd/zstd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
index e8f6315222..75eb6ecc07 100644
--- a/package/zstd/zstd.mk
+++ b/package/zstd/zstd.mk
@@ -36,7 +36,7 @@ ZSTD_OPTS += HAVE_LZ4=0
 endif
 
 # zstd will append -O3 after $(CFLAGS), use MOREFLAGS to override again
-ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION)"
+ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION) -D_GNU_SOURCE"
 
 ZSTD_BUILD_LIBS_BASENAMES = libzstd.pc
 ifeq ($(BR2_STATIC_LIBS),y)
-- 
2.35.1

_______________________________________________
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/zstd: pass _GNU_SOURCE in CFLAGS
  2022-06-12 20:09 [Buildroot] [PATCH 1/1] package/zstd: pass _GNU_SOURCE in CFLAGS Fabrice Fontaine
@ 2022-06-14 19:12 ` Arnout Vandecappelle via buildroot
  2022-07-25 10:10   ` Arnout Vandecappelle
  0 siblings, 1 reply; 3+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2022-06-14 19:12 UTC (permalink / raw)
  To: Fabrice Fontaine, buildroot; +Cc: Andrey Smirnov



On 12/06/2022 22:09, Fabrice Fontaine wrote:
> Fix the following build failure:
> 
> util.c: In function 'UTIL_utime':
> util.c:173:27: error: 'stat_t' {aka 'const struct stat'} has no member named 'st_mtim'; did you mean 'st_mtime'?
>    173 |     timebuf[1] = statbuf->st_mtim;
>        |                           ^~~~~~~
>        |                           st_mtime
> 
> Fixes:
>   - http://autobuild.buildroot.org/results/dd944a3bd4ac0c94b2bec8ac209100daaf43903d
> 
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
>   package/zstd/zstd.mk | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
> index e8f6315222..75eb6ecc07 100644
> --- a/package/zstd/zstd.mk
> +++ b/package/zstd/zstd.mk
> @@ -36,7 +36,7 @@ ZSTD_OPTS += HAVE_LZ4=0
>   endif
>   
>   # zstd will append -O3 after $(CFLAGS), use MOREFLAGS to override again
> -ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION)"
> +ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION) -D_GNU_SOURCE"

  Although this workaround seems quite innocuous, it doesn't feel like the right 
thing to do. Indeed, the code around the use of st_mtim already does every 
effort of making sure that the toolchain really supports st_mtim.

  Actually, it feels like a bug in glibc. POSIX require st_mtim to exist, so 
requiring _GNU_SOURCE for it is just plain wrong. Indeed, in 
sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h, the largefile definition 
of st_mtim is protected by the __USE_MISC macro, while the non-largefile 
definition is protected by the __USE_XOPEN2K8 macro (which is the correct one). 
So I'd rather patch glibc.

  Apparently, Debian has a similar problem on Alpha [1].

[1] https://github.com/facebook/zstd/pull/2986

>   
>   ZSTD_BUILD_LIBS_BASENAMES = libzstd.pc
>   ifeq ($(BR2_STATIC_LIBS),y)
_______________________________________________
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/zstd: pass _GNU_SOURCE in CFLAGS
  2022-06-14 19:12 ` Arnout Vandecappelle via buildroot
@ 2022-07-25 10:10   ` Arnout Vandecappelle
  0 siblings, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2022-07-25 10:10 UTC (permalink / raw)
  To: Fabrice Fontaine, buildroot; +Cc: Andrey Smirnov


On 14/06/2022 21:12, Arnout Vandecappelle wrote:
>
>
> On 12/06/2022 22:09, Fabrice Fontaine wrote:
>> Fix the following build failure:
>>
>> util.c: In function 'UTIL_utime':
>> util.c:173:27: error: 'stat_t' {aka 'const struct stat'} has no member named 
>> 'st_mtim'; did you mean 'st_mtime'?
>>    173 |     timebuf[1] = statbuf->st_mtim;
>>        |                           ^~~~~~~
>>        |                           st_mtime
>>
>> Fixes:
>>   - 
>> http://autobuild.buildroot.org/results/dd944a3bd4ac0c94b2bec8ac209100daaf43903d
>>
>> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
>> ---
>>   package/zstd/zstd.mk | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/package/zstd/zstd.mk b/package/zstd/zstd.mk
>> index e8f6315222..75eb6ecc07 100644
>> --- a/package/zstd/zstd.mk
>> +++ b/package/zstd/zstd.mk
>> @@ -36,7 +36,7 @@ ZSTD_OPTS += HAVE_LZ4=0
>>   endif
>>     # zstd will append -O3 after $(CFLAGS), use MOREFLAGS to override again
>> -ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION)"
>> +ZSTD_OPTS += MOREFLAGS="$(TARGET_OPTIMIZATION) -D_GNU_SOURCE"
>
>  Although this workaround seems quite innocuous, it doesn't feel like the 
> right thing to do. Indeed, the code around the use of st_mtim already does 
> every effort of making sure that the toolchain really supports st_mtim.
>
>  Actually, it feels like a bug in glibc. POSIX require st_mtim to exist, so 
> requiring _GNU_SOURCE for it is just plain wrong. Indeed, in 
> sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h, the largefile 
> definition of st_mtim is protected by the __USE_MISC macro, while the 
> non-largefile definition is protected by the __USE_XOPEN2K8 macro (which is 
> the correct one). So I'd rather patch glibc.

  So that's exactly what I did [1]. Marked as superseded.


  Regards,
  Arnout

[1] 
https://patchwork.ozlabs.org/project/buildroot/patch/20220725100745.2878896-1-arnout@mind.be/



>
>  Apparently, Debian has a similar problem on Alpha [1].
>
> [1] https://github.com/facebook/zstd/pull/2986
>
>>     ZSTD_BUILD_LIBS_BASENAMES = libzstd.pc
>>   ifeq ($(BR2_STATIC_LIBS),y)
_______________________________________________
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:[~2022-07-25 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12 20:09 [Buildroot] [PATCH 1/1] package/zstd: pass _GNU_SOURCE in CFLAGS Fabrice Fontaine
2022-06-14 19:12 ` Arnout Vandecappelle via buildroot
2022-07-25 10:10   ` Arnout Vandecappelle

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.