Subject: build failure on Android, due to S_MAGIC_* symbols

From: Bruno Haible <[email-masked]>
Date: Tue, 29 Jan 2019 04:19:42 +0100

Hi,

Compiling coreutils on Android produces this error:

  CC       src/tail.o
In file included from ../src/tail.c:63:
../src/fs-is-local.h: In function 'is_local_fs_type':
../src/fs-is-local.h:9: error: 'S_MAGIC_AAFS' undeclared (first use in this function)
../src/fs-is-local.h:9: error: (Each undeclared identifier is reported only once
../src/fs-is-local.h:9: error: for each function it appears in.)
../src/fs-is-local.h:10: error: 'S_MAGIC_ACFS' undeclared (first use in this function)
../src/fs-is-local.h:11: error: 'S_MAGIC_ADFS' undeclared (first use in this function)
../src/fs-is-local.h:12: error: 'S_MAGIC_AFFS' undeclared (first use in this function)
../src/fs-is-local.h:13: error: 'S_MAGIC_AFS' undeclared (first use in this function)
../src/fs-is-local.h:14: error: 'S_MAGIC_ANON_INODE_FS' undeclared (first use in this function)
../src/fs-is-local.h:15: error: 'S_MAGIC_AUFS' undeclared (first use in this function)
../src/fs-is-local.h:16: error: 'S_MAGIC_AUTOFS' undeclared (first use in this function)
../src/fs-is-local.h:17: error: 'S_MAGIC_BALLOON_KVM' undeclared (first use in this function)
../src/fs-is-local.h:18: error: 'S_MAGIC_BEFS' undeclared (first use in this function)
../src/fs-is-local.h:19: error: 'S_MAGIC_BDEVFS' undeclared (first use in this function)
../src/fs-is-local.h:20: error: 'S_MAGIC_BFS' undeclared (first use in this function)
../src/fs-is-local.h:21: error: 'S_MAGIC_BPF_FS' undeclared (first use in this function)
../src/fs-is-local.h:22: error: 'S_MAGIC_BINFMTFS' undeclared (first use in this function)
../src/fs-is-local.h:23: error: 'S_MAGIC_BTRFS' undeclared (first use in this function)
../src/fs-is-local.h:24: error: 'S_MAGIC_BTRFS_TEST' undeclared (first use in this function)
../src/fs-is-local.h:25: error: 'S_MAGIC_CEPH' undeclared (first use in this function)
../src/fs-is-local.h:26: error: 'S_MAGIC_CGROUP' undeclared (first use in this function)
../src/fs-is-local.h:27: error: 'S_MAGIC_CGROUP2' undeclared (first use in this function)
../src/fs-is-local.h:28: error: 'S_MAGIC_CIFS' undeclared (first use in this function)
../src/fs-is-local.h:29: error: 'S_MAGIC_CODA' undeclared (first use in this function)
../src/fs-is-local.h:30: error: 'S_MAGIC_COH' undeclared (first use in this function)
../src/fs-is-local.h:31: error: 'S_MAGIC_CONFIGFS' undeclared (first use in this function)
../src/fs-is-local.h:32: error: 'S_MAGIC_CRAMFS' undeclared (first use in this function)
../src/fs-is-local.h:33: error: 'S_MAGIC_CRAMFS_WEND' undeclared (first use in this function)
../src/fs-is-local.h:34: error: 'S_MAGIC_DAXFS' undeclared (first use in this function)
../src/fs-is-local.h:35: error: 'S_MAGIC_DEBUGFS' undeclared (first use in this function)
../src/fs-is-local.h:36: error: 'S_MAGIC_DEVFS' undeclared (first use in this function)
../src/fs-is-local.h:37: error: 'S_MAGIC_DEVPTS' undeclared (first use in this function)
../src/fs-is-local.h:38: error: 'S_MAGIC_ECRYPTFS' undeclared (first use in this function)
../src/fs-is-local.h:39: error: 'S_MAGIC_EFIVARFS' undeclared (first use in this function)
../src/fs-is-local.h:40: error: 'S_MAGIC_EFS' undeclared (first use in this function)
../src/fs-is-local.h:41: error: 'S_MAGIC_EXFS' undeclared (first use in this function)
../src/fs-is-local.h:42: error: 'S_MAGIC_EXOFS' undeclared (first use in this function)
../src/fs-is-local.h:43: error: 'S_MAGIC_EXT' undeclared (first use in this function)
../src/fs-is-local.h:44: error: 'S_MAGIC_EXT2' undeclared (first use in this function)
../src/fs-is-local.h:45: error: 'S_MAGIC_EXT2_OLD' undeclared (first use in this function)
../src/fs-is-local.h:46: error: 'S_MAGIC_F2FS' undeclared (first use in this function)
../src/fs-is-local.h:47: error: 'S_MAGIC_FAT' undeclared (first use in this function)
../src/fs-is-local.h:48: error: 'S_MAGIC_FHGFS' undeclared (first use in this function)
../src/fs-is-local.h:49: error: 'S_MAGIC_FUSEBLK' undeclared (first use in this function)
../src/fs-is-local.h:50: error: 'S_MAGIC_FUSECTL' undeclared (first use in this function)
../src/fs-is-local.h:51: error: 'S_MAGIC_FUTEXFS' undeclared (first use in this function)
../src/fs-is-local.h:52: error: 'S_MAGIC_GFS' undeclared (first use in this function)
../src/fs-is-local.h:53: error: 'S_MAGIC_GPFS' undeclared (first use in this function)
../src/fs-is-local.h:54: error: 'S_MAGIC_HFS' undeclared (first use in this function)
../src/fs-is-local.h:55: error: 'S_MAGIC_HFS_PLUS' undeclared (first use in this function)
../src/fs-is-local.h:56: error: 'S_MAGIC_HFS_X' undeclared (first use in this function)
../src/fs-is-local.h:57: error: 'S_MAGIC_HOSTFS' undeclared (first use in this function)
../src/fs-is-local.h:58: error: 'S_MAGIC_HPFS' undeclared (first use in this function)
../src/fs-is-local.h:59: error: 'S_MAGIC_HUGETLBFS' undeclared (first use in this function)
../src/fs-is-local.h:60: error: 'S_MAGIC_MTD_INODE_FS' undeclared (first use in this function)
../src/fs-is-local.h:61: error: 'S_MAGIC_IBRIX' undeclared (first use in this function)
../src/fs-is-local.h:62: error: 'S_MAGIC_INOTIFYFS' undeclared (first use in this function)
../src/fs-is-local.h:63: error: 'S_MAGIC_ISOFS' undeclared (first use in this function)
../src/fs-is-local.h:64: error: 'S_MAGIC_ISOFS_R_WIN' undeclared (first use in this function)
../src/fs-is-local.h:65: error: 'S_MAGIC_ISOFS_WIN' undeclared (first use in this function)
../src/fs-is-local.h:66: error: 'S_MAGIC_JFFS' undeclared (first use in this function)
../src/fs-is-local.h:67: error: 'S_MAGIC_JFFS2' undeclared (first use in this function)
../src/fs-is-local.h:68: error: 'S_MAGIC_JFS' undeclared (first use in this function)
../src/fs-is-local.h:69: error: 'S_MAGIC_KAFS' undeclared (first use in this function)
../src/fs-is-local.h:70: error: 'S_MAGIC_LOGFS' undeclared (first use in this function)
../src/fs-is-local.h:71: error: 'S_MAGIC_LUSTRE' undeclared (first use in this function)
../src/fs-is-local.h:72: error: 'S_MAGIC_M1FS' undeclared (first use in this function)
../src/fs-is-local.h:73: error: 'S_MAGIC_MINIX' undeclared (first use in this function)
../src/fs-is-local.h:74: error: 'S_MAGIC_MINIX_30' undeclared (first use in this function)
../src/fs-is-local.h:75: error: 'S_MAGIC_MINIX_V2' undeclared (first use in this function)
../src/fs-is-local.h:76: error: 'S_MAGIC_MINIX_V2_30' undeclared (first use in this function)
../src/fs-is-local.h:77: error: 'S_MAGIC_MINIX_V3' undeclared (first use in this function)
../src/fs-is-local.h:78: error: 'S_MAGIC_MQUEUE' undeclared (first use in this function)
../src/fs-is-local.h:79: error: 'S_MAGIC_MSDOS' undeclared (first use in this function)
../src/fs-is-local.h:80: error: 'S_MAGIC_NCP' undeclared (first use in this function)
../src/fs-is-local.h:81: error: 'S_MAGIC_NFS' undeclared (first use in this function)
../src/fs-is-local.h:82: error: 'S_MAGIC_NFSD' undeclared (first use in this function)
../src/fs-is-local.h:83: error: 'S_MAGIC_NILFS' undeclared (first use in this function)
../src/fs-is-local.h:84: error: 'S_MAGIC_NSFS' undeclared (first use in this function)
../src/fs-is-local.h:85: error: 'S_MAGIC_NTFS' undeclared (first use in this function)
../src/fs-is-local.h:86: error: 'S_MAGIC_OPENPROM' undeclared (first use in this function)
../src/fs-is-local.h:87: error: 'S_MAGIC_OCFS2' undeclared (first use in this function)
../src/fs-is-local.h:88: error: 'S_MAGIC_OVERLAYFS' undeclared (first use in this function)
../src/fs-is-local.h:89: error: 'S_MAGIC_PANFS' undeclared (first use in this function)
../src/fs-is-local.h:90: error: 'S_MAGIC_PIPEFS' undeclared (first use in this function)
../src/fs-is-local.h:91: error: 'S_MAGIC_PRL_FS' undeclared (first use in this function)
../src/fs-is-local.h:92: error: 'S_MAGIC_PROC' undeclared (first use in this function)
../src/fs-is-local.h:93: error: 'S_MAGIC_PSTOREFS' undeclared (first use in this function)
../src/fs-is-local.h:94: error: 'S_MAGIC_QNX4' undeclared (first use in this function)
../src/fs-is-local.h:95: error: 'S_MAGIC_QNX6' undeclared (first use in this function)
../src/fs-is-local.h:96: error: 'S_MAGIC_RAMFS' undeclared (first use in this function)
../src/fs-is-local.h:97: error: 'S_MAGIC_RDTGROUP' undeclared (first use in this function)
../src/fs-is-local.h:98: error: 'S_MAGIC_REISERFS' undeclared (first use in this function)
../src/fs-is-local.h:99: error: 'S_MAGIC_ROMFS' undeclared (first use in this function)
../src/fs-is-local.h:100: error: 'S_MAGIC_RPC_PIPEFS' undeclared (first use in this function)
../src/fs-is-local.h:101: error: 'S_MAGIC_SECURITYFS' undeclared (first use in this function)
../src/fs-is-local.h:102: error: 'S_MAGIC_SELINUX' undeclared (first use in this function)
../src/fs-is-local.h:103: error: 'S_MAGIC_SMACK' undeclared (first use in this function)
../src/fs-is-local.h:104: error: 'S_MAGIC_SMB' undeclared (first use in this function)
../src/fs-is-local.h:105: error: 'S_MAGIC_SMB2' undeclared (first use in this function)
../src/fs-is-local.h:106: error: 'S_MAGIC_SNFS' undeclared (first use in this function)
../src/fs-is-local.h:107: error: 'S_MAGIC_SOCKFS' undeclared (first use in this function)
../src/fs-is-local.h:108: error: 'S_MAGIC_SQUASHFS' undeclared (first use in this function)
../src/fs-is-local.h:109: error: 'S_MAGIC_SYSFS' undeclared (first use in this function)
../src/fs-is-local.h:110: error: 'S_MAGIC_SYSV2' undeclared (first use in this function)
../src/fs-is-local.h:111: error: 'S_MAGIC_SYSV4' undeclared (first use in this function)
../src/fs-is-local.h:112: error: 'S_MAGIC_TMPFS' undeclared (first use in this function)
../src/fs-is-local.h:113: error: 'S_MAGIC_TRACEFS' undeclared (first use in this function)
../src/fs-is-local.h:114: error: 'S_MAGIC_UBIFS' undeclared (first use in this function)
../src/fs-is-local.h:115: error: 'S_MAGIC_UDF' undeclared (first use in this function)
../src/fs-is-local.h:116: error: 'S_MAGIC_UFS' undeclared (first use in this function)
../src/fs-is-local.h:117: error: 'S_MAGIC_UFS_BYTESWAPPED' undeclared (first use in this function)
../src/fs-is-local.h:118: error: 'S_MAGIC_USBDEVFS' undeclared (first use in this function)
../src/fs-is-local.h:119: error: 'S_MAGIC_V9FS' undeclared (first use in this function)
../src/fs-is-local.h:120: error: 'S_MAGIC_VMHGFS' undeclared (first use in this function)
../src/fs-is-local.h:121: error: 'S_MAGIC_VXFS' undeclared (first use in this function)
../src/fs-is-local.h:122: error: 'S_MAGIC_VZFS' undeclared (first use in this function)
../src/fs-is-local.h:123: error: 'S_MAGIC_WSLFS' undeclared (first use in this function)
../src/fs-is-local.h:124: error: 'S_MAGIC_XENFS' undeclared (first use in this function)
../src/fs-is-local.h:125: error: 'S_MAGIC_XENIX' undeclared (first use in this function)
../src/fs-is-local.h:126: error: 'S_MAGIC_XFS' undeclared (first use in this function)
../src/fs-is-local.h:127: error: 'S_MAGIC_XIAFS' undeclared (first use in this function)
../src/fs-is-local.h:128: error: 'S_MAGIC_ZFS' undeclared (first use in this function)
../src/fs-is-local.h:129: error: 'S_MAGIC_ZSMALLOC' undeclared (first use in this function)
make[2]: *** [src/tail.o] Error 1

The Android libc, Bionic, does not define any of these S_MAGIC_* symbols or
macros, even in the newest version [1].

Can some #ifdef be used to avoid this build failure?
'defined __ANDROID__' tests for Android.
'defined __linux__' tests for Linux excluding Android.

Bruno

[1] https://android.googlesource.com/platform/bionic/