cannot build gcc 3.2.3 in Suse 10.3 (gcc 4.2.1)

Andrew Haley aph@redhat.com
Mon Jan 7 05:16:00 GMT 2008


Andrew Haley writes:
 > Matteo Rama writes:
 >  > thanks for the reply. It looks like replacing line 662 of read-rtl.c with
 >  > obstack_ptr_grow (&vector_stack, read_rtx (infile));
 >  > doesn't fix the problem. The error is still there:
 >  > ...
 >  > ../../gcc-3.2.3/gcc/read-rtl.c: In function 'read_rtx':
 >  > ../../gcc-3.2.3/gcc/read-rtl.c:662: error: lvalue required as increment operand
 >  > ../../gcc-3.2.3/gcc/read-rtl.c:662:60: warning: C++ style comments are
 >  > not allowed in ISO C90
 >  > ../../gcc-3.2.3/gcc/read-rtl.c:662:60: warning: (this will be reported
 >  > only once per input file)
 >  > make[1]: *** [read-rtl.o] Error 1
 >  > make[1]: Leaving directory `/root/gcc/obj/gcc'
 >  > make: *** [all-gcc] Error 2
 > 
 > Well, you're going to have to fix the code.  Feel free to ask us, but
 > we'll need more information, such as the preprocessed source.
 > 
 > Yeah, I suppose I could try building it myself, but it's not a very
 > interesting thing to do.  I might try a build later.

OK, I tried it.

Add this patch:

Index: system.h
===================================================================
--- system.h	(revision 131336)
+++ system.h	(working copy)
@@ -578,6 +578,7 @@
 #define really_call_calloc calloc
 #define really_call_realloc realloc
 
+
 #if (GCC_VERSION >= 3000)
 
 /* Note autoconf checks for prototype declarations and includes
@@ -589,7 +590,9 @@
 #undef realloc
 #undef calloc
 #undef strdup
+#if ! (defined(FLEX_SCANNER) || defined(YYBISON) || defined(YYBYACC))
  #pragma GCC poison malloc realloc calloc strdup
+#endif
 
 /* Old target macros that have moved to the target hooks structure.  */
  #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN			\
@@ -628,4 +631,11 @@
 
 #endif /* GCC >= 3.0 */
 
+#if defined(FLEX_SCANNER) || defined(YYBISON) || defined(YYBYACC)
+/* Flex and bison use malloc and realloc.  Yuk.  Note that this means
+   really_call_* cannot be used in a .l or .y file.  */
+#define malloc xmalloc
+#define realloc xrealloc
+#endif
+
 #endif /* ! GCC_SYSTEM_H */


Configure like this:

  CC='gcc -g -ansi -std=c89' /home/aph/gcc/gcc-3_2-branch/configure --enable-languages=c++

Build:

  make bootstrap

Ought to do it.

Andrew.

-- 
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903



More information about the Gcc-help mailing list