This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/955: build failure with GDB-5.3: sparc-nat.c structure redefinition errors with sparc64-linux, glibc-2.2.x


>Number:         955
>Category:       gdb
>Synopsis:       build failure with GDB-5.3: sparc-nat.c structure redefinition errors with sparc64-linux, glibc-2.2.x
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 24 00:38:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     nix@esperi.demon.co.uk
>Release:        GNU gdb 5.3
>Organization:
>Environment:
OS:
Linux amaterasu 2.4.20-pre9 #1 Fri Jan 17 08:32:54 GMT 2003 sparc64 unknown (32-bit userspace)
(the bug is definitely sparclinux-specific)

Compiler:
Configured with: /usr/packages/gcc/3.2.1/configure --with-gnu-ld --with-gnu-as --enable-shared --disable-static --prefix=/usr --verbose --enable-threads --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2.1

GDB configured for sparc-unknown-linux-gnu

configure flags: --with-x --disable-shared --enable-static --enable-mmap --enable-commonbfdlib --with-gnu-ld --with-curses --verbose --enable-gdbmi --enable-gdbcli --enable-tui --disable-gdbtk

CFLAGS: -O2 -mcpu=ultrasparc -mtune=ultrasparc -m32 -g -pipe -D__NO_STRING_INLINES -D__NO_MATH_INLINES -D_FILE_OFFSET_BITS=64
>Description:
Building GDB-5.3 on the above system fails. If I use the 2.4.19pre9 kernel headers which glibc was built against, I get

gcc -c -O2  -mcpu=ultrasparc -mtune=ultrasparc -m32 -g -pipe -D__NO_STRING_INLINES -D__NO_MATH_INLINES -D_FILE_OFFSET_BITS=64     -I. -I/usr/packages/gdb/gdb/gdb -I/usr/packages/gdb/gdb/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I/usr/packages/gdb/gdb/gdb/../include/opcode -I/usr/packages/gdb/gdb/gdb/../readline/.. -I../bfd -I/usr/packages/gdb/gdb/gdb/../bfd  -I/usr/packages/gdb/gdb/gdb/../include -I../intl -I/usr/packages/gdb/gdb/gdb/../intl -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE  -DMI_OUT=1 -DTUI=1 -I/usr/packages/gdb/gdb/gdb/tui -DUI_OUT=1 -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized  /usr/packages/gdb/gdb/gdb/sparc-nat.c
In file included from /usr/packages/gdb/gdb/gdb/sparc-nat.c:36:
/usr/include/asm/reg.h:40: redefinition of `struct fpq'
/usr/include/asm/reg.h:45: redefinition of `struct fq'
/usr/include/asm/reg.h:75: redefinition of `struct fpu'
make[1]: *** [sparc-nat.o] Error 1

Using the latest 2.4.20 headers yields

gcc -c -O2  -mcpu=ultrasparc -mtune=ultrasparc -m32 -g -pipe -D__NO_STRING_INLINES -D__NO_MATH_INLINES -D_FILE_OFFSET_BITS=64  -D__NO_STRING_INLINES -D__NO_MATH_INLINES -D_FILE_OFFSET_BITS=64     -I. -I/usr/packages/gdb/gdb/gdb -I/usr/packages/gdb/gdb/gdb/config -DLOCALEDIR="\"/usr/share/locale\"" -DHAVE_CONFIG_H -I/usr/packages/gdb/gdb/gdb/../include/opcode -I/usr/packages/gdb/gdb/gdb/../readline/.. -I../bfd -I/usr/packages/gdb/gdb/gdb/../bfd  -I/usr/packages/gdb/gdb/gdb/../include -I../intl -I/usr/packages/gdb/gdb/gdb/../intl -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE  -DMI_OUT=1 -DTUI=1 -I/usr/packages/gdb/gdb/gdb/tui -DUI_OUT=1 -Wimplicit -Wreturn-type -Wcomment -Wtrigraphs -Wformat -Wparentheses -Wpointer-arith -Wuninitialized  /usr/packages/gdb/gdb/gdb/sparc-nat.c
In file included from /usr/packages/gdb/gdb/gdb/sparc-nat.c:36:
/usr/include/asm/reg.h:49: redefinition of `struct fpu'
/usr/packages/gdb/gdb/gdb/sparc-nat.c: In function `fetch_inferior_registers':
/usr/packages/gdb/gdb/gdb/sparc-nat.c:105: structure has no member named `r_ps'
/usr/packages/gdb/gdb/gdb/sparc-nat.c:106: structure has no member named `r_pc'
/usr/packages/gdb/gdb/gdb/sparc-nat.c:107: structure has no member named `r_npc'
/usr/packages/gdb/gdb/gdb/sparc-nat.c: In function `store_inferior_registers':
/usr/packages/gdb/gdb/gdb/sparc-nat.c:254: structure has no member named `r_ps'
/usr/packages/gdb/gdb/gdb/sparc-nat.c:256: structure has no member named `r_pc'
/usr/packages/gdb/gdb/gdb/sparc-nat.c:258: structure has no member named `r_npc'
/usr/packages/gdb/gdb/gdb/sparc-nat.c: In function `fetch_core_registers':
/usr/packages/gdb/gdb/gdb/sparc-nat.c:312: structure has no member named `r_ps'
/usr/packages/gdb/gdb/gdb/sparc-nat.c:313: structure has no member named `r_pc'
/usr/packages/gdb/gdb/gdb/sparc-nat.c:314: structure has no member named `r_npc'
make: *** [sparc-nat.o] Error 1

(the extra errors are because reg.h has lost some #defines that GDB uses in recent stable Linux versions.)

The structure redefinition error seems to happen because glibc <signal.h> combined with _XOPEN_SOURCE triggers inclusion of <sys/ucontext.h>, which defines some of the same things as does Linux's <asm-sparc64/regs.h> (and defines them differently to boot)...

The solution I'm not clear on, except that presumably Linus would rather that a GDB-local copy of reg.h were used :)
>How-To-Repeat:
Compiling GDB does the trick for me; I can provide preprocessed source of sparc-nat.c if wanted. (The system is self-built so may have arbitrarily many configuration weirdnesses, although I try to keep them down. :) )
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]