Building GDB from source

Hi all;

I’ve retrieved the GDB source from QNX CVS. I need to build a
cross-debugger for a PPC target.

I’ve built it on Solaris, and it worked (well, it compiled; I haven’t
tried the debugger yet). Then I tried to build it for Linux and the
compile fails with errors trying to build elf32.c:

In file included from /devtools/QNXsrc/tools/gdb/bfd/elfcore.h:41,
from /devtools/QNXsrc/tools/gdb/bfd/elfcode.h:1517,
from /devtools/QNXsrc/tools/gdb/bfd/elf32.c:23:
/devtools/QNXsrc/tools/gdb/bfd/…/include/nto_procfs.h:38: conflicting types for pthread_t' /usr/include/bits/pthreadtypes.h:142: previous declaration of pthread_t’

It turns out that Linux declares pthread_t to be an unsigned long int,
while nto_procfs.h declares it to be a uint32_t, which is an unsigned
int, hence the problem.

I checked back with my Solaris build and although it did succeed, I
noticed that there were similar problems (warnings only though) when
building elf32.c on Solaris:

In file included from /devtools/QNXsrc/tools/gdb/bfd/…/include/nto_procfs.h:6,
from /devtools/QNXsrc/tools/gdb/bfd/elfcore.h:41,
from /devtools/QNXsrc/tools/gdb/bfd/elfcode.h:1517,
from /devtools/QNXsrc/tools/gdb/bfd/elf32.c:23:
/devtools/QNXsrc/tools/gdb/bfd/…/include/nto_inttypes.h:8: warning: redefinition of int8_t' /usr/include/sys/int_types.h:62: warning: int8_t’ previously declared here

/devtools/QNXsrc/tools/gdb/bfd/…/include/nto_procfs.h:38: warning: redefinition of pthread_t' /usr/include/sys/types.h:346: warning: pthread_t’ previously declared here


I can probably hack a fix for the Linux build, but I guess I’m wondering
if this doesn’t point out some deeper problem with the compile; if we
are getting all these type conflicts or redefinitions doesn’t that seem
to imply we have the wrong compiler options or something? Maybe this
doesn’t matter.

Paul D. Smith <pausmith@nortelnetworks.com> HASMAT–HA Software Mthds & Tools
“Please remain calm…I may be mad, but I am a professional.” --Mad Scientist

These are my opinions—Nortel Networks takes no responsibility for them.