This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.
Please visit our production wiki at https://wiki.gentoo.org
Glibc 2.26 porting notes/sysmacros.h
From Gentoo Wiki (test)
Description
To support upcoming c++
standards glibc
plans to remove <sys/sysmacros.h>
from glibc
's <sys/types.h>
. See the announcement.
<sys/sysmacros.h>
defines the following macros:
major()
minor()
makedev()
Build breakage usually looks like that:
bdev/lxclvm.c: In function 'lvm_detect':
bdev/lxclvm.c:140:4: error: implicit declaration of function 'major' [-Werror=implicit-function-declaration]
major(statbuf.st_rdev), minor(statbuf.st_rdev));
^~~~~
bdev/lxclvm.c:140:28: error: implicit declaration of function 'minor' [-Werror=implicit-function-declaration]
major(statbuf.st_rdev), minor(statbuf.st_rdev));
^~~~~
How to fix
autoconf-based systems
Note: <sys/sysmacros.h>
is a non-standard header.
Most portable fix across various libcs is to use [AC_HEADER_MAJOR] macro.
# somewhere in configure.ac:
# lookup major()/minor()/makedev()
AC_HEADER_MAJOR
/* somewhere in C code */
#ifdef MAJOR_IN_MKDEV
# include <sys/mkdev.h>
#endif
#ifdef MAJOR_IN_SYSMACROS
# include <sys/sysmacros.h>
#endif
Links
- Autocong manual: AC_HEADER_MAJOR
- Tracking bug: bug #575232
- Example fix: https://github.com/lxc/lxc/commit/af6824fce9c9536fbcabef8d5547f6c486f55fdf