Red Hat Bugzilla – Bug 244336
failed to build btrfsck in btrfs-progs package
Last modified: 2007-11-30 17:12:07 EST
Description of problem:
Wanted to play with btrfs:
on a rawhide box, however the btrfsck tools will not build.
After some testing it seems like it will build on Fedora Core 6, but not
on Fedora 7 or rawhide. The error I get is:
gcc -g -Wall -fno-strict-aliasing -Werror -c btrfsck.c
In file included from /usr/include/fcntl.h:38,
/usr/include/sys/stat.h:370: error: array type has incomplete element type
As Fedora 7 and rawhide has newer glibc, the problem might be here.
Version-Release number of selected component (if applicable):
Download btrfs-progs and try to build on Fedora 7 or rawhide.
btrfsck.c is just buggy:
#define _XOPEN_SOURCE 500
__USE_GNU macro is glibc implementation detail, no program must ever touch it.
info libc 'Feature Test Macros'
The feature test macros (_*_SOURCE) must be defined before including any header.
In this case SUSv3 namespace is not enough, as they want the readahead prototype.
But #define __USE_GNU is a wrong way to choose it, the right way is to
#define _GNU_SOURCE 1
above the first included header (either instead of _XOPEN_SOURCE 500 or together