sergiodj at redhat dot com
2018-09-12 22:40:46 UTC
https://sourceware.org/bugzilla/show_bug.cgi?id=23643
Bug ID: 23643
Summary: Update gnulib copy (and fix possible problems)
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: sergiodj at redhat dot com
CC: tromey at sourceware dot org
Target Milestone: ---
This is a bug meant to gather information about the problems that were
found while trying to update our local gnulib copy using gnulib's HEAD
as of August, 2018. An attempt has been made to do this update, but
had to be reverted subsequently.
The gnulib HEAD used to attempt the update was:
commit 53e2c179f26a890fa6685af4b6c1397ee370433b (HEAD -> master,
origin/master, origin/HEAD)
Author: Paul Eggert <***@cs.ucla.edu>
Date: Sat Aug 25 20:40:55 2018 -0700
autoupdate
This caused (at least) two major problems.
1) Breakage when compiling GDB using GCC 4.8
This failure was caught primarily by the s390x builders (in our
BuildBot), and we initially thought it was architecture-specific.
However, these builders were all using GCC 4.8 (or sub-versions of it)
to compile GDB. This version of GCC defaults to compiling things
using C89, even though it supports C99 (or even C11). The compilation
fails with:
In file included from
../../../../binutils-gdb/gdb/gnulib/import/scratch_buffer.h:9:0,
from ../../../../binutils-gdb/gdb/gnulib/import/glob.c:87:
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer.h:69:3:
error: unknown type name max_align_t
max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)];
^
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer.h:69:39:
error: max_align_t undeclared here (not in a function)
max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)];
^
../../../../binutils-gdb/gdb/gnulib/import/glob.c: In function glob_in_dir:
../../../../binutils-gdb/gdb/gnulib/import/glob.c:1413:15: error: for loop
initial declarations are only allowed in C99 mode
for (size_t i = 0; i < cur; ++i)
^
../../../../binutils-gdb/gdb/gnulib/import/glob.c:1413:15: note: use option
-std=c99 or -std=gnu99 to compile your code
../../../../binutils-gdb/gdb/gnulib/import/glob.c:1438:15: error: for loop
initial declarations are only allowed in C99 mode
for (size_t i = 0; i < cur; ++i)
^
make[8]: *** [glob.o] Error 1
make[8]: *** Waiting for unfinished jobs....
In file included from
../../../../binutils-gdb/gdb/gnulib/import/scratch_buffer.h:9:0,
from
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer_grow.c:23:
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer.h:69:3:
error: unknown type name max_align_t
max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)];
^
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer.h:69:39:
error: max_align_t undeclared here (not in a function)
max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)];
An initial investigation was done, and can be found here:
https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00157.html
The reason this is happening is this:
a) gnulib has code (see 'm4/std-gnu11.m4' on gnulib's source) to
identify whether the compiler is using an old C standard to compile
files, and to explicitly activate a newer standard if needed (by
modifying the CC environment variable). For this specific case (using
GCC 4.8), 'gnulib/Makefile' ended up with:
...
CC=gcc -std=gnu11
...
b) GDB, when invoking gnulib's Makefile, uses the following
incantation:
all-lib: $(GNULIB_BUILDDIR)/Makefile
@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=$(GNULIB_BUILDDIR) subdir_do
.PHONY: all-lib
The "subdir_do" rule is:
subdir_do: force
@for i in $(DODIRS); do \
...
if [ -f ./$$i/Makefile ] ; then \
if (cd ./$$i; \
$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ;
\
else exit 1 ; fi ; \
else true ; fi ; \
done
Which is correct, and should work at first glance. However,
FLAGS_TO_PASS contains:
FLAGS_TO_PASS = \
...
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
"CXX=$(CXX)" \
"CXX_DIALECT=$(CXX_DIALECT)" \
"CXXFLAGS=$(CXXFLAGS)" \
...
Which ends up overriding 'gnulib/Makefile's CC/CXX variables.
It's also important to notice that 'gnulib/Makefile' has its own
version of FLAGS_TO_PASS, which may also cause problems.
A few possible paths to fix this issue have been suggested here:
https://sourceware.org/ml/gdb-patches/2018-08/msg00814.html
https://sourceware.org/ml/gdb-patches/2018-08/msg00881.html
After spending some time trying to fix the build, I decided to revert
the update, so we're still using an old version of gnulib.
2) Breakage when cross-compiling GDB using MingW
The compilation fails with:
...
make[3]: Leaving directory
'/home/sergio/work/src/git/binutils-gdb/build-64-mingw/gdb'
CXX unittests/string_view-selftests.o
In file included from
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:10:0,
from build-gnulib/import/stdio.h:139,
from ../../binutils-gdb/gdb/common/common-defs.h:75,
from ../../binutils-gdb/gdb/defs.h:28,
from
../../binutils-gdb/gdb/unittests/string_view-selftests.c:26:
build-gnulib/import/wctype.h: In member function
'gnulib::_gl_iswalnum_wrapper::operator gnulib::_gl_iswalnum_wrapper::type()
const':
build-gnulib/import/wctype.h:856:1: error: invalid conversion from 'int
(*)(wint_t) {aka int (*)(short unsigned int)}' to
'gnulib::_gl_iswalnum_wrapper::type {aka int (*)(unsigned int)}' [-fpermissive]
_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
^
build-gnulib/import/wctype.h: In member function
'gnulib::_gl_iswalpha_wrapper::operator gnulib::_gl_iswalpha_wrapper::type()
const':
build-gnulib/import/wctype.h:857:1: error: invalid conversion from 'int
(*)(wint_t) {aka int (*)(short unsigned int)}' to
'gnulib::_gl_iswalpha_wrapper::type {aka int (*)(unsigned int)}' [-fpermissive]
_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
^
...
I haven't had the chance to deeply investigate this. I've sent an
email to the gnulib mailing list:
https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00160.html
But received no replies.
Bug ID: 23643
Summary: Update gnulib copy (and fix possible problems)
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: sergiodj at redhat dot com
CC: tromey at sourceware dot org
Target Milestone: ---
This is a bug meant to gather information about the problems that were
found while trying to update our local gnulib copy using gnulib's HEAD
as of August, 2018. An attempt has been made to do this update, but
had to be reverted subsequently.
The gnulib HEAD used to attempt the update was:
commit 53e2c179f26a890fa6685af4b6c1397ee370433b (HEAD -> master,
origin/master, origin/HEAD)
Author: Paul Eggert <***@cs.ucla.edu>
Date: Sat Aug 25 20:40:55 2018 -0700
autoupdate
This caused (at least) two major problems.
1) Breakage when compiling GDB using GCC 4.8
This failure was caught primarily by the s390x builders (in our
BuildBot), and we initially thought it was architecture-specific.
However, these builders were all using GCC 4.8 (or sub-versions of it)
to compile GDB. This version of GCC defaults to compiling things
using C89, even though it supports C99 (or even C11). The compilation
fails with:
In file included from
../../../../binutils-gdb/gdb/gnulib/import/scratch_buffer.h:9:0,
from ../../../../binutils-gdb/gdb/gnulib/import/glob.c:87:
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer.h:69:3:
error: unknown type name max_align_t
max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)];
^
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer.h:69:39:
error: max_align_t undeclared here (not in a function)
max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)];
^
../../../../binutils-gdb/gdb/gnulib/import/glob.c: In function glob_in_dir:
../../../../binutils-gdb/gdb/gnulib/import/glob.c:1413:15: error: for loop
initial declarations are only allowed in C99 mode
for (size_t i = 0; i < cur; ++i)
^
../../../../binutils-gdb/gdb/gnulib/import/glob.c:1413:15: note: use option
-std=c99 or -std=gnu99 to compile your code
../../../../binutils-gdb/gdb/gnulib/import/glob.c:1438:15: error: for loop
initial declarations are only allowed in C99 mode
for (size_t i = 0; i < cur; ++i)
^
make[8]: *** [glob.o] Error 1
make[8]: *** Waiting for unfinished jobs....
In file included from
../../../../binutils-gdb/gdb/gnulib/import/scratch_buffer.h:9:0,
from
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer_grow.c:23:
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer.h:69:3:
error: unknown type name max_align_t
max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)];
^
../../../../binutils-gdb/gdb/gnulib/import/malloc/scratch_buffer.h:69:39:
error: max_align_t undeclared here (not in a function)
max_align_t __space[(1023 + sizeof (max_align_t)) / sizeof (max_align_t)];
An initial investigation was done, and can be found here:
https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00157.html
The reason this is happening is this:
a) gnulib has code (see 'm4/std-gnu11.m4' on gnulib's source) to
identify whether the compiler is using an old C standard to compile
files, and to explicitly activate a newer standard if needed (by
modifying the CC environment variable). For this specific case (using
GCC 4.8), 'gnulib/Makefile' ended up with:
...
CC=gcc -std=gnu11
...
b) GDB, when invoking gnulib's Makefile, uses the following
incantation:
all-lib: $(GNULIB_BUILDDIR)/Makefile
@$(MAKE) $(FLAGS_TO_PASS) DO=all DODIRS=$(GNULIB_BUILDDIR) subdir_do
.PHONY: all-lib
The "subdir_do" rule is:
subdir_do: force
@for i in $(DODIRS); do \
...
if [ -f ./$$i/Makefile ] ; then \
if (cd ./$$i; \
$(MAKE) $(FLAGS_TO_PASS) $(DO)) ; then true ;
\
else exit 1 ; fi ; \
else true ; fi ; \
done
Which is correct, and should work at first glance. However,
FLAGS_TO_PASS contains:
FLAGS_TO_PASS = \
...
"CC=$(CC)" \
"CFLAGS=$(CFLAGS)" \
"CXX=$(CXX)" \
"CXX_DIALECT=$(CXX_DIALECT)" \
"CXXFLAGS=$(CXXFLAGS)" \
...
Which ends up overriding 'gnulib/Makefile's CC/CXX variables.
It's also important to notice that 'gnulib/Makefile' has its own
version of FLAGS_TO_PASS, which may also cause problems.
A few possible paths to fix this issue have been suggested here:
https://sourceware.org/ml/gdb-patches/2018-08/msg00814.html
https://sourceware.org/ml/gdb-patches/2018-08/msg00881.html
After spending some time trying to fix the build, I decided to revert
the update, so we're still using an old version of gnulib.
2) Breakage when cross-compiling GDB using MingW
The compilation fails with:
...
make[3]: Leaving directory
'/home/sergio/work/src/git/binutils-gdb/build-64-mingw/gdb'
CXX unittests/string_view-selftests.o
In file included from
/usr/x86_64-w64-mingw32/sys-root/mingw/include/io.h:10:0,
from build-gnulib/import/stdio.h:139,
from ../../binutils-gdb/gdb/common/common-defs.h:75,
from ../../binutils-gdb/gdb/defs.h:28,
from
../../binutils-gdb/gdb/unittests/string_view-selftests.c:26:
build-gnulib/import/wctype.h: In member function
'gnulib::_gl_iswalnum_wrapper::operator gnulib::_gl_iswalnum_wrapper::type()
const':
build-gnulib/import/wctype.h:856:1: error: invalid conversion from 'int
(*)(wint_t) {aka int (*)(short unsigned int)}' to
'gnulib::_gl_iswalnum_wrapper::type {aka int (*)(unsigned int)}' [-fpermissive]
_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
^
build-gnulib/import/wctype.h: In member function
'gnulib::_gl_iswalpha_wrapper::operator gnulib::_gl_iswalpha_wrapper::type()
const':
build-gnulib/import/wctype.h:857:1: error: invalid conversion from 'int
(*)(wint_t) {aka int (*)(short unsigned int)}' to
'gnulib::_gl_iswalpha_wrapper::type {aka int (*)(unsigned int)}' [-fpermissive]
_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
^
...
I haven't had the chance to deeply investigate this. I've sent an
email to the gnulib mailing list:
https://lists.gnu.org/archive/html/bug-gnulib/2018-08/msg00160.html
But received no replies.
--
You are receiving this mail because:
You are on the CC list for the bug.
You are receiving this mail because:
You are on the CC list for the bug.