Hi There :) I've Stumbled Upon This Issue While Trying To Upgrade a 'musl-libc' Based System. Some Folks at The 'LIBpcap' Project Seem To Have Stumbled Upon That Issue Too & They've Found/Proposed a Simple - 3-Liner - Fix on 05/01/2019. Reproducible: Always Steps to Reproduce: 1. Do a Plain 'emerge -av =sys-fs/btrfs-progs-5.13' . Actual Results: [CC] common/send-utils.o x86_64-gentoo-linux-musl-gcc -O3 -march=haswell -mtune=goldmont-plus -maes -mno-avx -mno-avx2 -mno-f16c -mno-fma -mno-bmi -mno-bmi2 -mno-lzcnt -mno-hle -pipe -std=gnu90 -include config.h -DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC -I. -I./libbtrfsutil -DCRYPTOPROVIDER_BUILTIN=1 -Wno-format-truncation -Wno-address-of-packed-member -Wimplicit-fallthrough -c common/send-utils.c -o common/send-utils.o \ cmds/filesystem-usage.c: In function 'get_first_device_zone_size': cmds/filesystem-usage.c:403:12: error: 'NAME_MAX' undeclared (first use in this function) 403 | char name[NAME_MAX] = {0}; | ^~~~~~~~ cmds/filesystem-usage.c:403:12: note: each undeclared identifier is reported only once for each function it appears in make: *** [Makefile:379: cmds/filesystem-usage.o] Error 1 Expected Results: [CC] common/send-utils.o x86_64-gentoo-linux-musl-gcc -O3 -march=haswell -mtune=goldmont-plus -maes -mno-avx -mno-avx2 -mno-f16c -mno-fma -mno-bmi -mno-bmi2 -mno-lzcnt -mno-hle -pipe -std=gnu90 -include config.h -DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC -I. -I./libbtrfsutil -DCRYPTOPROVIDER_BUILTIN=1 -Wno-format-truncation -Wno-address-of-packed-member -Wimplicit-fallthrough -c common/send-utils.c -o common/send-utils.o \ true -O3 -march=haswell -mtune=goldmont-plus -maes -mno-avx -mno-avx2 -mno-f16c -mno-fma -mno-bmi -mno-bmi2 -mno-lzcnt -mno-hle -pipe -std=gnu90 -include config.h -DBTRFS_FLAT_INCLUDES -D_XOPEN_SOURCE=700 -fno-strict-aliasing -fPIC -I. -I./libbtrfsutil -DCRYPTOPROVIDER_BUILTIN=1 -Wno-format-truncation -Wno-address-of-packed-member -Wimplicit-fallthrough -include .cc-defines.h -D__CHECKER__ -D__CHECK_ENDIAN__ -Wbitwise -Wuninitialized -Wshadow -Wundef -U_FORTIFY_SOURCE -Wdeclaration-after-statement -Wdefault-bitfield-sign -DBTRFSCONVERT_EXT2=1 -DBTRFSCONVERT_REISERFS=0 kernel-lib/rbtree.c
Yeah, should just be missing limits.h include. Could you include the full build.log (attached) and emerge --info in a comment for completeness? Thanks!
Created attachment 723760 [details, diff] a 3-liner musl libc compatibility patch : cmds/filesystem-usage.c
The __GLIBC__ include guard is unnecessary. Also, please submit any patches upstream, and we can backport from there.
Fixed upstream: https://github.com/kdave/btrfs-progs/commit/d302bf5b344b486405bb10ac2302c1315b7290de The fix is already in 5.13.1 which builds fine again.
Fixed btrfs-progs-5.13.1 is already in portage. Builds fine again on musl. Closing here.