drake icon indicating copy to clipboard operation
drake copied to clipboard

New glibc changes causing headmaster grief

Open Earnestly opened this issue 6 years ago • 4 comments

During the build process when headmaster is invoked it results in the following errors:

import.h:144:1: <bits/libio.h> is not found.
/usr/include/netdb.h:608:11: macro AI_IDN_ALLOW_UNASSIGNED is failed to preprocess.
/usr/include/netdb.h:610:11: macro AI_IDN_USE_STD3_ASCII_RULES is failed to preprocess.
/usr/include/netdb.h:649:11: macro NI_IDN_ALLOW_UNASSIGNED is failed to preprocess.
/usr/include/netdb.h:651:11: macro NI_IDN_USE_STD3_ASCII_RULES is failed to preprocess.
/usr/include/sys/cdefs.h:423:10: macro __attribute_nonstring__ is failed to parse.
/usr/include/bits/byteswap.h:37:10: __builtin_bswap16 is undeclared.
/usr/include/bits/types/struct_FILE.h:112:37: currently, macro argument could not be inferenced as struct or union.
/usr/include/bits/types/struct_FILE.h:112:9: expression-like macro __feof_unlocked_body is failed to interpret.
/usr/include/bits/types/struct_FILE.h:115:39: currently, macro argument could not be inferenced as struct or union.
/usr/include/bits/types/struct_FILE.h:115:9: expression-like macro __ferror_unlocked_body is failed to interpret.
/usr/include/bits/types/struct_FILE.h:103:22: currently, macro argument could not be inferenced as struct or union.
/usr/include/bits/types/struct_FILE.h:102:9: expression-like macro __getc_unlocked_body is failed to interpret.
/usr/include/bits/types/struct_FILE.h:107:22: currently, macro argument could not be inferenced as struct or union.
/usr/include/bits/types/struct_FILE.h:106:9: expression-like macro __putc_unlocked_body is failed to interpret.
make: *** [Makefile;737: adainclude/c.ads] Error 1

Oh my system (running a very recent build of glibc) libio.h is now gone, instead of being deprecated. They recommend you use stdio.h instead.

See https://sourceware.org/git/?p=glibc.git;a=commit;h=a4fea3f2c3253b9ae6ffacd3747034ccbe56bc60


As for the rest, here's the offending lines and a bit of context for the rest:

  • netdb.h:
#  define AI_IDN_ALLOW_UNASSIGNED \
  __glibc_macro_warning ("AI_IDN_ALLOW_UNASSIGNED is deprecated") 0x0100
#  define AI_IDN_USE_STD3_ASCII_RULES \
  __glibc_macro_warning ("AI_IDN_USE_STD3_ASCII_RULES is deprecated") 0x0200
  • cdefs.h:
# define __attribute_nonstring__ __attribute__ ((__nonstring__))
  • byteswap.h:
static __inline __uint16_t
__bswap_16 (__uint16_t __bsx)
{
#if __GNUC_PREREQ (4, 8)
  return __builtin_bswap16 (__bsx);
#else
  return __bswap_constant_16 (__bsx);
#endif
}
  • struct_FILE.h:
/* These macros are used by bits/stdio.h and internal headers.  */
#define __getc_unlocked_body(_fp)					\
  (__glibc_unlikely ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end)	\
   ? __uflow (_fp) : *(unsigned char *) (_fp)->_IO_read_ptr++)

#define __putc_unlocked_body(_ch, _fp)					\
  (__glibc_unlikely ((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end)	\
   ? __overflow (_fp, (unsigned char) (_ch))				\
   : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))

#define _IO_EOF_SEEN 0x0010
#define __feof_unlocked_body(_fp) (((_fp)->_flags & _IO_EOF_SEEN) != 0)

#define _IO_ERR_SEEN 0x0020
#define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0)

Earnestly avatar Jun 11 '18 09:06 Earnestly

Thanks.

The glibc's headers (<= 2.27??, current stable version at least) have the problem of circular reference between stdio.h and libio.h. So libio.h should be included before malloc.h that includes stdio.h, to control the order of their declarations.

I have not understood and will explore what about the problem has become in the recent version...

ytomino avatar Jun 11 '18 15:06 ytomino

I has built latest glibc just now, and noticed that __GLIBC_MINOR__ is still 27, not incremented yet. We can not determine the under-development version by #if at this time (without reuse of the other differences).

https://sourceware.org/git/?p=glibc.git;a=blob;f=include/features.h;h=d22c32eee6a98c350cad4267b15355fb271b9818;hb=HEAD#l420

BTW, libio.h may be replaced to struct_FILE.h.

ytomino avatar Jun 12 '18 22:06 ytomino

I use glibc built from git master, so these changes are probably coming in the next release version.

Earnestly avatar Jun 13 '18 07:06 Earnestly

https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=3c03baca37fdcb52c3881e653ca392bba7a99c2b

__GLIBC_MINOR__ has been incremented now. I'll retry to build...

ytomino avatar Aug 07 '18 01:08 ytomino