Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 719826 - [musl overlay] Add sys-fs/xfsprogs to musl overlay with MIPS patches to fix MAP_SYNC issues
Summary: [musl overlay] Add sys-fs/xfsprogs to musl overlay with MIPS patches to fix M...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Overlays (show other bugs)
Hardware: MIPS Linux
: Normal normal (vote)
Assignee: Gentoo musl team
Keywords: PATCH
Depends on:
Reported: 2020-04-27 17:14 UTC by Joshua Kinard
Modified: 2020-10-30 18:41 UTC (History)
2 users (show)

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

Check for MAP_SYNC in sys/mman.h (xfsprogs-5.5.0-check-for-MAP_SYNC-in-sys-mman_h.patch,1.57 KB, patch)
2020-04-27 17:17 UTC, Joshua Kinard
Details | Diff
Include include/xfs/linux.h after <sys/mman.h> (xfsprogs-5.5.0-include-include-xfs-linux_h-after-sys-mman_h.patch,806 bytes, patch)
2020-04-27 17:18 UTC, Joshua Kinard
Details | Diff
Ebuild diff against xfsprogs-5.5.0.ebuild to add patches (xfsprogs-5.5.0_ebuild-musl-patches-for-mips.diff,444 bytes, patch)
2020-04-27 17:22 UTC, Joshua Kinard
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Kinard gentoo-dev 2020-04-27 17:14:37 UTC
I would like sys-fs/xfsprogs added to the musl overlay w/ two patches from the OpenBMC project to make it buildable on MIPS.  The patches are attached as-is from OpenBMC.  they fix the following compile-time error:

mips-unknown-linux-musl-gcc -O2 -pipe -march=mips3 -mtune=mips3 -mplt -mfix-r4000 -mfix-r4400 -D_FILE_OFFSET_BITS=64 -Wno-address-of-packed-member    -DNDEBUG -DVERSION=\"5.5.0\" -DLOCALEDIR=\"/usr/share/locale\" -DPACKAGE=\"xfsprogs\" -I../include -I../libxfs -I.. -DENABLE_GETTEXT -D_GNU_SOURCE -funsigned-char -fno-strict-aliasing -Wall -DHAVE_MNTENT -DHAVE_FSETXATTR -DENABLE_BLKID -DHAVE_GETFSMAP -DHAVE_FALLOCATE -DHAVE_FADVISE -DHAVE_MADVISE -DHAVE_MINCORE -DHAVE_SENDFILE -DHAVE_FIEMAP -DHAVE_COPY_FILE_RANGE -DHAVE_SYNC_FILE_RANGE -DHAVE_SYNCFS -DHAVE_FALLOCATE -DHAVE_PREADV -DHAVE_PWRITEV -DHAVE_READDIR -DHAVE_MREMAP -DHAVE_STATFS_FLAGS -c mmap.c
mmap.c: In function _mmap_f_:
mmap.c:192:12: error: _MAP_SYNC_ undeclared (first use in this function); did you mean _MS_SYNC_?
  192 |    flags = MAP_SYNC | MAP_SHARED_VALIDATE;
      |            ^~~~~~~~
      |            MS_SYNC
mmap.c:192:12: note: each undeclared identifier is reported only once for each function it appears in
gmake[2]: *** [../include/buildrules:81: mmap.o] Error 1
gmake[1]: *** [include/buildrules:36: io] Error 2
gmake[1]: *** Waiting for unfinished jobs....
Comment 1 Joshua Kinard gentoo-dev 2020-04-27 17:17:56 UTC
Created attachment 634922 [details, diff]
Check for MAP_SYNC in sys/mman.h

From: Khem Raj <>
Date: Thu, 23 Aug 2018 04:59:39 +0000
Subject: [PATCH] Check for MAP_SYNC in sys/mman.h

Not all arches have wired MAP_SYNC e.g. mips
which have conflicts with definition, so checking
a generic file is going to mis-configure xfsprogs
for such arches.

libc now has added the relevant macros to
sys/mman.h, and returns the right values for arches
where its implemented and nothing for others
unlike asm-generic/mman.h which only checks
for kernel headers and ignored arches
Comment 2 Joshua Kinard gentoo-dev 2020-04-27 17:18:35 UTC
Created attachment 634924 [details, diff]
Include include/xfs/linux.h after <sys/mman.h>

From: Khem Raj <>
Date: Thu, 23 Aug 2018 05:33:57 +0000
Subject: [PATCH] include include/xfs/linux.h after <sys/mman.h>

This helps compiling with musl which goes ahead and undefines MAP_SYNC
for mips and other architectures where its not wired in kernel
Comment 3 Joshua Kinard gentoo-dev 2020-04-27 17:22:04 UTC
Created attachment 634926 [details, diff]
Ebuild diff against xfsprogs-5.5.0.ebuild to add patches
Comment 4 Joshua Kinard gentoo-dev 2020-10-30 05:24:24 UTC
musl team: ping

Patches and ebuild diff still apply to xfsprogs-5.8.0 with no issues, so if someone gets to this at some point, please apply it at minimum to xfsprogs-5.8.0.  5.9.0 came out after I took my portage snapshot for catalyst, so I have not tested there just yet.
Comment 5 Michael 'veremitz' Everitt 2020-10-30 17:02:18 UTC
We're trying not to /add/ new packages to the musl overlay, as maintenance is already a burden. Thankfully many upstreams are merging patches as they're made aware, and other musl-based distros are helping out here.

CC'ing base@ as they are maintainers of the package in ::gentoo whilst I do further 'homework' on upstreaming.
Comment 6 Michael 'veremitz' Everitt 2020-10-30 18:41:31 UTC
Ok, so I've checked in with xfs upstream, spoken to Khem directly, and the only thing blocking merging is to check compatibility with older glibc's where MAP_SYNC wasn't provided directly, and kernel headers had to be checked.

Hopefully I can look into this over the next few days (RHEL7 is a potential test target) and re-submit to XFS ML, and we'll go from there.