ytomino / drake

Drake: A Runtime Library for gcc-Ada
https://github.com/ytomino/drake/wiki
MIT License
42 stars 10 forks source link

New glibc changes causing headmaster grief #9

Open Earnestly opened 6 years ago

Earnestly commented 6 years ago

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:

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)

ytomino commented 6 years ago

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 commented 6 years ago

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.

Earnestly commented 6 years ago

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

ytomino commented 6 years ago

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

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