Subject: toolchain/16709: cross-gdb (linux -> next68k) does not build from src/tools
To: None <gnats-bugs@gnats.netbsd.org>
From: None <chris@Pin.LU>
List: netbsd-bugs
Date: 05/08/2002 03:00:21
>Number:         16709
>Category:       toolchain
>Synopsis:       cross-gdb (linux -> next68k) does not build from src/tools
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 07 18:41:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Christian Limpach
>Release:        current (as of May 6 2002)
>Organization:
	
>Environment:
	
Debian GNU/Linux with gcc 2.95


>Description:
	
	building a cross-gdb on a linux host fails because bfd.h
	and stdbool.h (from gcc >= 2.95) define true/false

cc -c -O     -I. -I/devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb -I/devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/config -DHAVE_CONFIG_H -I/devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/../include/opcode -I/devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/../readline/..  -I../bfd -I/devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/../bfd  -I/devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/../include  -I../intl -I/devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/../intl -I/devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/tui   -DUSE_INCLUDED_REGEX   /devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/utils.c
In file included from /usr/include/curses.h:111,
                 from /devel/netbsd/current-lvm/syssrc/tools/toolchain/../../gnu/dist/toolchain/gdb/utils.c:28:
/usr/lib/gcc-lib/i386-linux/2.95.4/include/stdbool.h:9: conflicting types for `false'
../bfd/bfd.h:102: previous declaration of `false'
/usr/lib/gcc-lib/i386-linux/2.95.4/include/stdbool.h:11: conflicting types for `true'
../bfd/bfd.h:102: previous declaration of `true'
*** Error code 1

Stop.

>How-To-Repeat:
	build cross-gdb on linux host

MKCROSSGDB=yes ./build.sh  -m next68k -t

(also setting ac_cv_header_fts_h=no is probably necessary because
 of toolchain/16138)

>Fix:
	use stdbool.h if present.  See also upstream fix/discussion:
	http://sources.redhat.com/ml/binutils/2002-01/msg00612.html

Index: bfd-in.h
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/bfd/bfd-in.h,v
retrieving revision 1.4
diff -u -r1.4 bfd-in.h
--- bfd-in.h    2001/08/14 04:43:05     1.4
+++ bfd-in.h    2002/05/08 01:27:13
@@ -90,8 +90,15 @@
 /* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
 /* It gets worse if the host also defines a true/false enum... -sts */
 /* And even worse if your compiler has built-in boolean types... -law */
+/* And even worse if your compiler provides a stdbool.h that conflicts
+   with these definitions... gcc 2.95 and later do.  -drow */
 #if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
 #define TRUE_FALSE_ALREADY_DEFINED
+#else
+#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
+#include <stdbool.h>
+#define TRUE_FALSE_ALREADY_DEFINED
+#endif
 #endif
 #ifdef MPW
 /* Pre-emptive strike - get the file with the enum.  */
Index: bfd-in2.h
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/toolchain/bfd/bfd-in2.h,v
retrieving revision 1.5
diff -u -r1.5 bfd-in2.h
--- bfd-in2.h   2001/08/14 04:43:05     1.5
+++ bfd-in2.h   2002/05/08 01:27:14
@@ -90,8 +90,15 @@
 /* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h>  -fnf */
 /* It gets worse if the host also defines a true/false enum... -sts */
 /* And even worse if your compiler has built-in boolean types... -law */
+/* And even worse if your compiler provides a stdbool.h that conflicts
+   with these definitions... gcc 2.95 and later do.  -drow */
 #if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
 #define TRUE_FALSE_ALREADY_DEFINED
+#else
+#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
+#include <stdbool.h>
+#define TRUE_FALSE_ALREADY_DEFINED
+#endif
 #endif
 #ifdef MPW
 /* Pre-emptive strike - get the file with the enum.  */




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