Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 948468 - sys-fs/xfsprogs-6.12.0 on musl: stat.c:354:56: error: 'struct statx' has no member named 'stx_atomic_write_unit_min'
Summary: sys-fs/xfsprogs-6.12.0 on musl: stat.c:354:56: error: 'struct statx' has no m...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-01-20 20:58 UTC by Goetz Fischer
Modified: 2025-03-14 14:53 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log.gz,8.87 KB, application/x-gzip)
2025-01-20 21:39 UTC, Goetz Fischer
Details
emerge_info (emerge_info.gz,2.88 KB, application/x-gzip)
2025-01-20 21:40 UTC, Goetz Fischer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Goetz Fischer 2025-01-20 20:58:46 UTC
emerge sys-fs/xfsprogs fails with:

stat.c: In function 'dump_raw_statx':
stat.c:354:56: error: 'struct statx' has no member named 'stx_atomic_write_unit_min'
  354 |         printf("stat.atomic_write_unit_min = %u\n", stx->stx_atomic_write_unit_min);
      |                                                        ^~
stat.c:355:56: error: 'struct statx' has no member named 'stx_atomic_write_unit_max'
  355 |         printf("stat.atomic_write_unit_max = %u\n", stx->stx_atomic_write_unit_max);
      |                                                        ^~
stat.c:356:60: error: 'struct statx' has no member named 'stx_atomic_write_segments_max'
  356 |         printf("stat.atomic_write_segments_max = %u\n", stx->stx_atomic_write_segments_max);
      |                                                            ^~
gmake[2]: *** [../include/buildrules:81: stat.o] Error 1
gmake[1]: *** [include/buildrules:36: io] Error 2
make: *** [Makefile:84: default] Error 2
 * ERROR: sys-fs/xfsprogs-6.12.0::gentoo failed (compile phase):

happens with amd64 and ppc64le, both musl-hardened.

Reproducible: Always
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-20 21:01:13 UTC
Please always include the full build.log and emerge --info. Please also don't CC arch teams.

This should have been fixed by:

commit f2a52b2ccb6cc830dba6f0b6be422308a5adbf65
Author: Sam James <sam@gentoo.org>
Date:   Sun Jan 12 13:08:18 2025 +0000

    sys-fs/xfsprogs: depend on >=sys-kernel/linux-headers-6.11

    stx_atomic_write_unit_min was added in 0f9ca80fa4f9670ba09721e4e36b8baf086a500c
    in linux.git, first in linux-6.11.

    Bug: https://bugs.gentoo.org/947965
    Signed-off-by: Sam James <sam@gentoo.org>
Comment 2 Goetz Fischer 2025-01-20 21:39:15 UTC
thanks for the quick reply but it didn't work. i ran emerge --sync in advance and installed sys-kernel/linux-headers again.

# qlist -ICv | fgrep headers
cross-powerpc64le-unknown-linux-musl/linux-headers-6.12
sys-kernel/linux-headers-6.12

emerge --info and build.log attached.
Comment 3 Goetz Fischer 2025-01-20 21:39:38 UTC
Created attachment 917187 [details]
build.log
Comment 4 Goetz Fischer 2025-01-20 21:40:09 UTC
Created attachment 917188 [details]
emerge_info
Comment 5 Alfred Wingate 2025-02-19 02:15:30 UTC
This can be worked around with -DOVERRIDE_SYSTEM_STATX in CFLAGS. 

The logic in check this will need some further investigation, the configure check are done with -D_GNU_SOURCE so sys/stat.h should have the statx struct defined, but it shouldnt have statx.stx_atomic_write_unit_min which still gets detected as available in the log.

https://git.kernel.org/pub/scm/fs/xfs/xfsprogs-dev.git/diff/?h=v6.12.0&id=409477af604f465169be9b2cbe259fe382f052ae

checking for struct statx... yes
checking for struct statx.stx_atomic_write_unit_min... yes
Comment 6 Alfred Wingate 2025-02-19 02:26:46 UTC
Ok, so the logic is that the checks are done against linux/sys.h, BUT they dont get included in statx.h if STATX_TYPE is set (that musls sys/stat.h would set of course).
Comment 7 Fabian Groffen gentoo-dev 2025-03-14 07:25:51 UTC
confirming, should we mask for musl profiles, or apply -DOVERRIDE_SYSTEM_STATX?

6.13.0-r1 has the same problem.

Thanks to parona for the hint, this would be a possible fix using the define:

--- a/sys-fs/xfsprogs/xfsprogs-6.12.0.ebuild
+++ b/sys-fs/xfsprogs/xfsprogs-6.12.0.ebuild
@@ -58,8 +58,8 @@ src_configure() {
        # Avoid automagic on libdevmapper (bug #709694)
        export ac_cv_search_dm_task_create=no
 
-       # bug 903611
-       use elibc_musl && append-flags -D_LARGEFILE64_SOURCE
+       # bug 903611, 948468
+       use elibc_musl && append-flags -D_LARGEFILE64_SOURCE -DOVERRIDE_SYSTEM_STATX
 
        # Build fails with -O3 (bug #712698)
        replace-flags -O3 -O2
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-14 07:31:06 UTC
Please apply -DOVERRIDE_SYSTEM_STATX, thanks!
Comment 9 Larry the Git Cow gentoo-dev 2025-03-14 07:46:41 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59746b5c334655b4de679bbf2406bc8e1bfade11

commit 59746b5c334655b4de679bbf2406bc8e1bfade11
Author:     Fabian Groffen <grobian@gentoo.org>
AuthorDate: 2025-03-14 07:38:26 +0000
Commit:     Fabian Groffen <grobian@gentoo.org>
CommitDate: 2025-03-14 07:40:28 +0000

    sys-fs/xfsprogs-6.1{2,3}: fix compilation on musl systems #948468
    
    Suggested-by: Alfred Wingate <parona@protonmail.com>
    Closes: https://bugs.gentoo.org/948468
    Signed-off-by: Fabian Groffen <grobian@gentoo.org>

 sys-fs/xfsprogs/xfsprogs-6.12.0.ebuild    | 5 +++--
 sys-fs/xfsprogs/xfsprogs-6.13.0-r1.ebuild | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)
Comment 10 Goetz Fischer 2025-03-14 14:21:06 UTC
downgrading -O3 is not necessary anymore.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-14 14:32:59 UTC
(In reply to Goetz Fischer from comment #10)
> downgrading -O3 is not necessary anymore.

That's not related to this bug.
Comment 12 Goetz Fischer 2025-03-14 14:36:53 UTC
well, it's shown in the commit log above.
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-14 14:53:22 UTC
(In reply to Goetz Fischer from comment #12)
> well, it's shown in the commit log above.

No, it's just patch context.