Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 802081 - >=sys-fs/btrfs-progs-5.12: 'NAME_MAX' undeclared cause build error on musl libc
Summary: >=sys-fs/btrfs-progs-5.12: 'NAME_MAX' undeclared cause build error on musl libc
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: 2021-07-13 23:47 UTC by Moran Z.
Modified: 2021-08-04 17:03 UTC (History)
1 user (show)

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


Attachments
a 3-liner musl libc compatibility patch : cmds/filesystem-usage.c (btrfs-progs-5.13-musl-fix.patch,327 bytes, patch)
2021-07-13 23:52 UTC, Moran Z.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Moran Z. 2021-07-13 23:47:04 UTC
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
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-07-13 23:49:08 UTC
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!
Comment 2 Moran Z. 2021-07-13 23:52:57 UTC
Created attachment 723760 [details, diff]
a 3-liner musl libc compatibility patch : cmds/filesystem-usage.c
Comment 3 Mike Gilbert gentoo-dev 2021-07-14 16:18:07 UTC
The __GLIBC__ include guard is unnecessary.

Also, please submit any patches upstream, and we can backport from there.
Comment 4 ernsteiswuerfel archtester 2021-07-31 20:04:23 UTC
Fixed upstream: https://github.com/kdave/btrfs-progs/commit/d302bf5b344b486405bb10ac2302c1315b7290de

The fix is already in 5.13.1 which builds fine again.
Comment 5 ernsteiswuerfel archtester 2021-08-04 17:03:00 UTC
Fixed btrfs-progs-5.13.1 is already in portage. Builds fine again on musl.

Closing here.